Specifies an alternate column header row for the imported file. The column header determines the names of the properties of the object that Import-Csv creates.
Enter a comma-separated list of the column headers. Enclose each item in quotation marks (single or double). Do not enclose the header string in quotation marks. If you enter fewer column headers than there are columns, the remaining columns will have no header. If you enter more headers than there are columns, the extra headers are ignored.
When using the Header parameter, delete the original header row from the CSV file. Otherwise, Import-Csv creates an extra object from the items in the header row.
Seems like your original CSV file already has headers ... at least AAA and BBB. Either you use the existing headers in CSV file or you specify them with your cmdlet. If I'm not wrong you cannot combine them.
The topic ‘Problem with Import-Csv and headers’ is closed to new replies.