A report export arrives with gaps between its sections, or a file has picked up a few hundred empty rows at the bottom. Selecting them and pressing delete is obvious, fast, and the reason people come back looking for a missing record a week later.
How to remove blank rows from a CSV
Remove rows where every field is empty after trimming
That rule catches all three things that are genuinely blank — an empty line, a line of bare commas, and a line of spaces — and keeps the one that is not: a row with a value in its first column and nothing after it. In a spreadsheet all four look the same.
parseCsv from the CSV tools on this site, run on each line as the page renders. Three of these are genuinely empty. The last one is not, and it is the row people delete when they select by eye — in a spreadsheet it looks exactly like the others.Why the last one catches people
A row like Irbid,, renders in a spreadsheet as a cell with a word in it and two empty cells beside it. Scrolling past a thousand rows, that reads as part of the empty stretch — especially if the word is short or the column is narrow.
It is a real record with missing fields, and missing fields are ordinary. A customer with no phone number. A line item with no discount. Deleting it does not corrupt the file, which is precisely the problem: everything still opens, the totals are slightly wrong, and nothing points at what happened.
Where the blank rows came from
Report exports write them on purpose, as separators between sections or as the remains of page breaks. These are decorative and go without argument.
Trailing newlines are not really blank rows at all. A file that ends with a newline is correctly terminated, and readers disagree about whether that implies one more row — which is why the same file counts 500 rows in one program and 501 in another. Nothing is wrong and nothing needs removing.
A broken quoted field is the dangerous source. A value containing a line break is legal when quoted, and something that ignored the quotes has split one record across two lines — so the "blank row" is the second half of a real one. If your blank rows appear immediately after rows containing addresses or free text, this is the first thing to check, and what the quotes are doing explains why the split happened.
Doing it without opening a spreadsheet
The reason to avoid Excel for this is the same reason to avoid it for most CSV surgery: it does not only remove what you asked it to. Open a file to delete some rows and it may also strip the leading zeros from your postcodes and turn a few part numbers into dates on the way past — and you will not see it until the file has been saved.
The CSV cleaner has Remove empty rows as one of its options. It trims each field before testing, so lines of spaces count as blank and Irbid,, does not, and it tells you the row count before and after — which is the number to check. If it removed more than you expected, the difference is rows that had something in them.
Blank rows and duplicate rows are different questions
Both are usually asked at once and only one is safe to answer without thinking. A blank row carries no information, so removing it cannot lose any. A duplicate row might be two genuine identical events — the same item sold twice at the same price on the same day — and collapsing them changes a total by exactly the amount nobody will notice.
Take the blanks first, look at the row count, and treat the duplicates as a separate decision with the data in front of you.
The short version
Blank means every field is empty after trimming — not "looks empty on screen". Check the row count before and after, and if blank rows sit immediately below rows with addresses in them, you have a quoting problem rather than an empty-row problem.