You don't need to pipe to Measure
to get the row count. In fact, the variable you've stored in $csv
is not the csv data but the output from Measure
, so you should remove the pipe to Measure
.
Here's an example:
PS C:\temp> $csv = Import-Csv .\test.csv
PS C:\temp> # Here you can perform your check on the size of the csv
PS C:\temp> $csv.Count
4
PS C:\temp> # ... and you can get all the data like this:
PS C:\temp> $csv
Year : 1997
Make : Ford
Model : E350
Description : ac, abs, moon
Price : 3000.00
Year : 1999
Make : Chevy
Model : Venture "Extended Edition"
Description :
Price : 4900.00
Year : 1999
Make : Chevy
Model : Venture "Extended Edition, Very Large"
Description :
Price : 5000.00
Year : 1996
Make : Jeep
Model : Grand Cherokee
Description : MUST SELL!
air, moon roof, loaded
Price : 4799.00
My csv looks like this:
Year,Make,Model,Description,Price
1997,Ford,E350,"ac, abs, moon",3000.00
1999,Chevy,"Venture ""Extended Edition""","",4900.00
1999,Chevy,"Venture ""Extended Edition, Very Large""",,5000.00
1996,Jeep,Grand Cherokee,"MUST SELL!
air, moon roof, loaded",4799.00