I need to extract data from CSV file based on coordinates entered by user, so let's say that user enter next values:
$rowPosition = 5
$columnName = 'testColumn'
and I need to get value from 5th row in column testColumn.
I know how to extract just one column, but I need further filtering with row position.
First, I created two variables consisting column name and row position in desired CSV file.
$columnName = 'testColumn'
$rowPosition = 2
Then I just access to specific cell at this way:
#Load .csv file into variable
$csvFile = Import-csv .\Desktop\counter.csv -Delimiter ','
echo $csvFile.$columnName[$rowPosition]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With