🧹 Data Cleaning · 8 min read
CSV Import Skipped Rows? Where They Went and How to Get Them Back
Nothing deletes rows silently except a ceiling or a broken quote, and the count tells you which. If the imported row count is a round limit such as 1,048,575 or a suspiciously clean fraction of the original, you hit a ceiling. If it is wildly short and one cell contains a wall of text, an unclosed double quote ate the rows. If it is short by a small fixed number, an import setting started reading below the top of the file.
Count first, diagnose second. Re-importing before you know the number just produces the same short file with more of your afternoon gone.
Step One: Get Three Numbers
You need the row count in the source file, the row count after import, and the width in columns. The gap between the first two narrows the cause to one of four.
wc -l shipments.csv # physical lines, fast, ignores quoting
head -1 shipments.csv # header, to count columns
tail -2 shipments.csv # confirm the file is not truncatedwc -l counts newline characters, so a field containing a quoted line break inflates it by one and a file without a final newline deflates it by one. For a number you can defend, let a real parser count:
import csv
with open("shipments.csv", newline="", encoding="utf-8") as f:
rows = sum(1 for _ in csv.reader(f))
print(rows - 1, "data rows")Cause 1: The Row Ceiling
Excel stops at 1,048,576 rows per worksheet, per Microsoft's published Excel specifications. Open a longer CSV in Excel and the extra rows are gone, with no dialog and no marker at the bottom. If your import ended on exactly 1,048,575 data rows plus a header, you are looking at the ceiling, not at data corruption.
The fix is not to reshape the file; it is to stop handing a 3 million row CSV to Excel. Split it into chunks that each fit, one file per region or per month, and keep the whole file for a tool that can hold it. The CSV splitter does this by row count and leaves every part with the header row intact. The row limit page covers the neighbouring symptom, where the file opens but the total is wrong.
Cause 2: The Cell Ceiling in Google Sheets
Sheets applies a different limit, and it is cells rather than rows: 10,000,000 cells per spreadsheet, per Google's published editor limits. Divide that by your column count and you get the real row ceiling. Ten columns buys a million rows; forty columns buys 250,000. A wide export that imports "partially" into Sheets and completely into a database is usually a cell ceiling, not a parsing failure.
Cause 3: An Unclosed Double Quote
This is the one that produces bizarre symptoms. RFC 4180 says a field containing a comma, a line break or a double quote must be wrapped in double quotes, and a literal double quote inside such a field is written twice. Miss the closing quote and the parser stays in quoted mode. Commas stop separating fields. Line breaks stop ending records. The next few hundred rows become one enormous cell, and the row count collapses.
Two checks catch it. Count the double quotes in the file; an odd total means one is unclosed. And look at the largest cell in the imported sheet: if a single cell holds text from several rows, that cell starts at the damage. Repair it by closing the quote at the right place and doubling any quote characters inside the text, not by deleting the row. If the row counts are off in the other direction, too many columns rather than too few rows, start with the column mismatch walkthrough instead.
Cause 4: The Importer Started Below the Top
Import dialogs carry settings that quietly drop the beginning of a file. Excel's text import has a "start import at row" box. Power Query asks which row holds the headers, and if you accept the detected value on a file with three title lines above the header, those three lines become your column names and the real header becomes a data row. A shortfall of exactly the number of preamble lines is the fingerprint.
Also check the boring explanation before the exotic one: an auto-filter left switched on hides rows without removing them, and a table range that stopped at row 5,000 makes the rest of the data invisible while it sits in the file. Click the filter off and look at the last populated row number in the sheet.
The Small Stuff That Adds Up
Whitespace-only lines and lines containing a single trailing comma are handled differently by different parsers. Some skip them, some read them as one-field records, and a one-field record in a forty-field file can make a strict loader abort at that line and keep nothing after it. Strip whitespace-only lines and blank trailing lines before importing. A stray delimiter at the end of every row is a different problem: it creates an unnamed extra column rather than losing rows, and it is worth cleaning anyway so the schema matches the header.
Duplicate header rows are the other frequent surprise. A file assembled from several exports often repeats the header mid-file; the importer reads the second one as data, and any numeric column becomes text from that point on. Find them with a quick scan for the header's first cell value, then remove the repeats.
Recovering Without Re-Exporting
If the source file itself is complete, you never need to ask anyone for a re-export. Split it, strip the whitespace lines, fix the quotes, and import again with the header row set explicitly. If the source file is short, the loss happened upstream, and no amount of import fiddling will bring rows back that were never written; compare the file against the system that produced it, using a row count and a checksum on a couple of columns rather than eyeballing the tail.
A file that opens with no data at all is a different fault. The empty import checklist covers the six reasons a CSV arrives blank, and counting rows properly explains why the number your editor shows and the number your database reports rarely match.
Frequently Asked Questions
Why did only some of my CSV rows import into Excel?
Usually the 1,048,576 row ceiling from Microsoft's Excel specifications, which truncates on open with no error dialog. Second most common is an unclosed double quote earlier in the file, which makes the parser read several real rows as one long field.
How do I count rows in a CSV without opening it?
wc -l counts newlines, which is close but not exact. For a number you can defend, read the file with Python's csv module and count records; it respects quoting, so a field with a line break inside does not inflate the total.
Why do rows go missing in Google Sheets but not in Excel?
Sheets caps a spreadsheet at 10,000,000 cells, per Google's editor limits, and cells are not rows. A forty-column file runs out around 250,000 rows, and the import stops quietly rather than reporting a failure.
Can a blank line make rows disappear?
A truly empty line usually gets skipped. A line with a single stray delimiter or a space is read inconsistently across parsers, and in a strict loader it can terminate the import. Strip whitespace-only lines before you try again.
What does an unclosed quote do to the rest of the file?
It keeps the parser in quoted mode, so commas and newlines stop separating anything until the next double quote. Hundreds of rows can merge into one cell. An odd number of double quotes in the file is the giveaway.
Count Before You Re-Import
The analyzer reports real row and column counts, plus any row whose width disagrees with the header, all in the browser.
Related reading
Data Cleaning — other guides that pair well with this one.
- CSV Files Lose Formatting After Save: Leading Zeros, Dates, Long Numbers
- Why Won't My CSV Open Correctly in Excel?
- CSV to TXT: What Converting to Plain Text Actually Means
- CSV Too Big for Google Sheets? The 20 Million Cell Limit
Browse all guides in the NoCodeCSV blog.