I'm looking for adding header to a csv file without header, and without information about columns number.
I have this code for csv file which I know column count :
$Content = Import-Csv "C:\temp\input.csv" -Delimiter ';' -Header "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23"
Which is the best way to create an header like mine, automatically ? Is "Header" parameter can be an arraylist of string value ?
I should code something like this :
$array = New-Object System.Collections.ArrayList
for ($i=1; $i -lt $Columns; $i++)
{
$array.add($i.ToString())
}