StriveFormats
GeneralGuide

Fix Blank Rows in a CSV File

How to find and delete blank rows in a CSV file before importing to Shopify, WooCommerce, Etsy, eBay, or Amazon, in Excel, Google Sheets, and Python.

Updated 2026-10-29
What you'll learn
  • ✓Why blank rows appear in CSV files and how they break imports
  • ✓How to find and delete blank rows in Excel, Google Sheets, and Python
  • ✓How to handle the common trailing blank row at the end of a file
  • ✓How to spot blank rows that aren't really blank (whitespace-only rows)
  • ✓How to prevent blank rows from reappearing in your exports
Best for: Sellers seeing import errors or unexpected empty products caused by blank rows in their CSV file
Time to complete: 6 minutes

Ready to fix your CSV? Upload it for instant validation and auto-fixes.

Open CSV Fixer

Why Blank Rows Cause Import Problems

A blank row in a CSV file is a row where all fields are empty (or just commas with no values). Many importers simply skip a fully blank row, but depending on the platform, a blank row can instead:

  • Create an empty product record (Title blank, Price blank), which fails required field validation
  • Stop the import at the blank row, silently ignoring everything after it
  • Report a validation error for each required field that's missing on the blank row

The most common places blank rows appear:

  • At the end of the file (spreadsheet editors often add one automatically)
  • Between products (you deleted a row but left a blank line)
  • Between sections if you organized your spreadsheet with visual gaps
  • After deleting cell contents: pressing Delete clears a row's cells but leaves the empty row in place

Find Blank Rows

In a text editor

Open the file in VS Code or Notepad. Blank rows are easy to spot. They're lines with only commas, or completely empty lines:

Handle,Title,Price
blue-shirt,Blue T-Shirt,19.99
                          ← blank row (just commas or empty)
red-shirt,Red T-Shirt,21.99

In Excel

Press Ctrl+End to jump to the last cell in the used range. If the last row is beyond your data (an empty row), Excel has included blank rows in the used range.

To find all blank rows, add a helper column after your last column, enter =COUNTA(A2:Z2) in row 2 (widen the range to cover all your columns) and fill it down. Rows showing 0 are completely blank.

Don't look for blanks in a single column such as Title: in a Shopify file, variant rows leave Title empty on purpose, and they are not blank rows.

Delete Blank Rows in Excel

Method 1: Delete trailing blank rows

  1. Press Ctrl+End to see where Excel thinks the data ends
  2. If it's beyond your last data row, select the extra rows below your data
  3. Right-click → Delete Rows
  4. Press Ctrl+End again to confirm the used range is now correct

Method 2: Delete all blank rows with a helper column

  1. Add the =COUNTA(A2:Z2) helper column described above
  2. Turn on a filter (Data → Filter) and show only rows where the helper column is 0
  3. Select those rows, right-click → Delete Row
  4. Clear the filter and delete the helper column

Avoid Go To Special → Blanks on a single column: it deletes every row where that column happens to be empty, including valid variant rows.

Delete Blank Rows in Google Sheets

Use the same helper column and a filter:

  1. Add a helper column with =COUNTA(A2:Z2) and fill it down
  2. Add a filter (Data → Create a filter)
  3. In the helper column's filter, show only 0
  4. Select the visible rows and delete them (right-click → Delete selected rows)
  5. Turn off the filter and delete the helper column

Sorting also moves blank rows to the bottom, but only sort a file whose row order doesn't matter. Shopify products, WooCommerce variations and eBay variation listings depend on their rows staying in order.

Delete Blank Rows in Python

For large files, Python is the fastest approach:

import csv

with open("input.csv", newline="", encoding="utf-8") as f_in, \
     open("output.csv", "w", newline="", encoding="utf-8") as f_out:
    reader = csv.reader(f_in)
    writer = csv.writer(f_out)
    for row in reader:
        # Keep the row if any field has a non-empty, non-whitespace value
        if any(cell.strip() for cell in row):
            writer.writerow(row)

This handles whitespace-only rows too (rows that appear blank but contain spaces or tabs).

Whitespace-Only Rows

Some rows look blank in a spreadsheet but actually contain spaces or tab characters in one or more cells. These rows won't be caught by simple "is the row empty?" checks.

Detect them in Python:

import csv

with open("input.csv", newline="", encoding="utf-8") as f:
    reader = csv.reader(f)
    for i, row in enumerate(reader, 1):
        if not any(cell.strip() for cell in row):
            print(f"Blank or whitespace-only row at line {i}")

The fix from the previous section (using cell.strip()) handles these automatically.

Prevent Blank Rows in Future Exports

  • In Excel: Before saving as CSV, press Ctrl+End and verify the last row with data is the actual last used row. Delete any rows below it.
  • In Google Sheets: the CSV download includes every row down to the last non-empty cell, so keep your data compact.
  • After deleting rows: In Excel, right-click the row numbers → Delete (not just pressing Delete on the cell contents, which leaves a blank row).
  • After filtering: Excel's CSV export includes rows hidden by a filter, so clear filters and check what's really in the sheet before exporting.

Fix This Automatically with StriveFormats

Upload your CSV to StriveFormats. The validator detects blank rows, whitespace-only rows, and rows where all required fields are empty. It shows their exact locations so you can remove them before importing.

Open CSV Fixer | View CSV Templates

Need help fixing your file?

Upload your CSV to StriveFormats for instant validation, auto-fixes, and a clean export.

The CSV Fixer showing a Shopify file with one blocking issue, the error and warning counts, and the problem cells highlighted