KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to process a csv file in powershell, but I don't know what the column headings in the CSV file will be when it is processed. For example: $path = "d:\scratch\export.csv" $csv = Import-csv -path $path foreach($line in $csv) { foreach ($head in $line | get-member | where-object {$_.MemberType -eq "NoteProperty"} | select Definition) { #pseudocode... doSomething($head.columnName, $head.value) } } How do I loop through the line in the csv file, getting the name of the column and the value? Or is there another way I should be doing this (like not using Import-csv)?
Tags (comma-separated)
Save Edits
Cancel