How can I count the number of rows in a csv file using powershell? I tried something like
Get-Content -length "C:\Directory\file.csv"
or
(Get-Content).length "C:\Directory\file.csv"
but these result an error.
How can I count the number of rows in a csv file using powershell? I tried something like
Get-Content -length "C:\Directory\file.csv"
or
(Get-Content).length "C:\Directory\file.csv"
but these result an error.
You can simply use unix like comand in powershell.
If you file test.csv Then command to get rowcount is
gc test.csv | Measure-Object
(Import-Csv C:\Directory\file.csv).count is the only accurate one out of these.
I tried all of the other suggestions on a csv with 4781 rows, and all but this one returned 4803.