I have a csv file that's structured like this:
Text,Url
Learning Haskell,https://wiki.haskell.org/Learning_Haskell
I'm attempting to get the row count before I loop over the csv file, because I don't want to start a loop on empty results.
From researching (1,2), it would seem that Import-csv
has a .Count
property, but for some reason I'm unable to access that property. I'm using Powershell v5.
Code:
[string]$markdownlink = "markdownlinks.csv"
[string]$processedLinks = "completedlinks.txt"
$markdownlinkstoProcess = Import-Csv $markdownlink -Delimiter ","
# Returns 0
[int]$count=$markdownlinkstoProcess.Count
Write-output $count