How to Remove Blank Rows from a CSV File
Blank rows are the #1 reason CSV imports fail silently. A client sends you a spreadsheet export, you upload it to your invoicing tool or CRM, and rows shift, totals break, or the import just errors out — all because of invisible empty lines scattered through the file.
Here's how to get rid of them, whichever tool you have handy.
Method 1: Excel
- Open the CSV in Excel.
- Select the entire sheet (
Ctrl+A). - Go to Home → Find & Select → Go To Special.
- Choose Blanks and click OK — every blank cell is now selected.
- Right-click any selected cell → Delete → Entire row.
- Save the file.
This works well, but watch out: it deletes any row containing a blank cell in the selection, so use it on a copy if some blanks are legitimate.
Method 2: Google Sheets
- Import the CSV into Google Sheets (File → Import).
- Select all (
Ctrl+A), then Data → Create a filter. - Click the filter icon on any column, uncheck (Blanks), and delete the visible blank rows.
- Or simpler: sort any column A→Z — blank rows sink to the bottom where you can delete them in one block.
Method 3: Python (for the technical)
import csv
with open('messy.csv', newline='', encoding='utf-8') as f:
rows = [r for r in csv.reader(f) if any(c.strip() for c in r)]
with open('clean.csv', 'w', newline='', encoding='utf-8') as f:
csv.writer(f).writerows(rows)
This keeps only rows that have at least one non-empty cell.
The one-click way
Don't want to do this by hand every time? CSV Cleaner removes blank rows automatically — along with messy headers and encoding problems — in one click. $9 once, yours forever.
See CSV CleanerMore CSV fixes: fix headers with spaces · convert to UTF-8 · CSV won't import?