bndit
asked on
Powershell: Best way to work with header column names in a CSV file
I have to work with a CSV file that has no header column names. I know what these column names are; so what would be the best approach to work with a file like this?
Is this the best way to handle it?
I'm pretty sure that if a column was deleted and/or added to the file without updating the header array, the import would fail, correct?
Is this the best way to handle it?
$header = "FirstName","LastName","EmployeeNumber" # so forth and so on
Import-csv c:\temp\myfile.csv -header $header
I'm pretty sure that if a column was deleted and/or added to the file without updating the header array, the import would fail, correct?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER