Import-Csv and blank lines - by Shay Levi

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 767851 Comments
Status Closed Workarounds
Type Suggestion Repros 0
Opened 10/17/2012 2:06:49 PM
Access Restriction Public


Consider the following CSV file:

# test.csv

# it ends here

When imported, blank lines are not ignored and converted to blank objects

PS> Import-Csv .\test.csv | fl *

Name : foo
Id   : 1

Name :
Id   :

Name :
Id   :

Blank lines can be easily introduced when authoring csv content, sometimes they are ignored or not spotted before the content is saved and it can lead to unexpected results, 
I can't see the value of empty objects, not to mention filtering them out. 

It would be great if Import-Csv (ConvertFrom-Csv) ignored blank lines or at least had a switch parameter (-IgnoreEmptyLines) to do that
Sign in to post a comment.