I'm attempting to import a csv, search the cell values(columns) in each row and then find and count any null or blank values. Then if the count hits 13, do X. However, when I run this code it appears the cell/column values are a single object and not the individual values for each column? How can I search the individual cell values in the row?
SAMPLE CODE
$DataFileLocation = "\\Server\Output.csv"
$sheet = import-csv $DataFileLocation
$count = 0
foreach ($row in $sheet) {
foreach ($column in $row) {
Write-Host "Searching value: $column"
if ($column -eq $null -or " ") {
Write-Host "Found a blank!"
$count++
}
}
$count
if ($count -eq 13) {
Write-Host "Found match!" -ForegroundColor Red
}
$count = 0
}