Powershell:Reading the header columns in a .CSV file using import-csv cmdlet
Posted by on November 25th, 2009
As my journey into the wonderland of Powershell continues, I stumbled upon the need to read the list of header columns from a .CSV file. You would have already used import-csv to read the content of a .CSV file. What a beauty! If you need to know the column headers in the file, you can try this approach: $headers=import-csv sample.csv | gm -member noteproperty foreach ($headerline in $headers) { out-host -Inputobject $headerline.name } I thank my colleagues at Microsoft for giving me this tip….(read more)
This post originated from and is provided by the MSDN Blogs RSS feed. The original post of the article can be found here.