Remove Empty lines in a CSV


Ever wanted to remove all empty lines from a CSV? Create a copy of the file and test out this code first as it may remove empty cells in multiple rows/columns

Import-Csv sample.csv | Where-Object { $_.PSObject.Properties.Value -ne $null}

Leave a comment

Your email address will not be published. Required fields are marked *