I am new to powershell, don't get to use this often.
I need to output the value of cell A5 from a csv file using powershell
my file -
col1 col2 col3 col4
---- ---- ---- ----
1002 1005 1006 1007
need value in the A1 cell i.e 1002.selection should be done by the cell numbers.
$a = @(Import-CSV filepath.csv)
$a[1].(col1)
thanks in advance
Row 1, Column 1 (A1)
Row 1, Column 5 (A5)
Import the CSV to your variable
Then grab the first row
$a[0]
and use.
notation to get the column you want. Note that the first row of data is0
because powershell converts the CSV to an object, seperating the headers and data.If you don't need any other values from the CSV, then you can forego the variable assignment and trim it down to: