I have a simple CSV file with 3 columns, and a header for row#1 (Name, Department, Region). I run the following command in Powershell but am not getting the values for each column into their respective arrays. I was hoping to import all cell values under Name column into a $name array, $department array and $region array. So far no luck.
$csv = Import-CSV ‘c:\users\myname\documents\resultdata.csv’
$name = $csv.Name
$department = $csv.Department
$region = $csv.Region
When i run the command $csv, it shows me the header and then the 3 values for Name, department and region. Something like this below. But if i run just $name, it does not show me anything, i was expecting a list of all names one line at a time. What am i doing wrong please? Thanks a bunch
Name Department Region
James Engineering Arizona