Blog

Why a long CSV has a different row count in Excel

Find out why Excel shows fewer or more rows than a long CSV, check the file's actual records, and choose a safe way to import or split it.

Lauren HughesTools and utilities 4 min read

You open a large CSV in Excel and the row count does not match what you expected. Maybe the sheet stops early, or a count from another tool is different. The cause could be Excel's worksheet limit, a filter, or the way the file marks rows.

Check the file itself before editing it. TooLab's CSV Editor can open CSV files up to 10 million rows in your browser, so you can compare parsed records with what Excel shows.

Compare the CSV with Excel

  1. Open the original file in the CSV Editor. Use its search to find a record you expect near the end, or inspect the last records that appear. Keep the original file unchanged while you check it.
  2. Open the same file in Excel. Check whether you are comparing total worksheet rows or data rows. If the first row contains column names, it counts as a worksheet row but is not a data record.
  3. Look for a known record near the end of the file in both places. Comparing an ID or other unique value is more reliable than comparing physical line numbers, because a CSV record can contain a line break inside a quoted cell.
  4. In Excel, check whether a filter is hiding rows, or whether rows are hidden manually. Also make sure the two views refer to the same file and that Excel has not opened an older copy.

If your file has more than one million rows, see how to open a CSV with more than 1 million rows for more ways to inspect it.

What the difference means

Excel stops at 1,048,576 rows

A worksheet in modern Excel has a maximum of 1,048,576 rows, including the header. That leaves room for 1,048,575 data rows when the first row contains column names. If your CSV has more records, a worksheet cannot display them all. Reaching the final worksheet row does not mean the rest of the source file is empty or deleted.

The counts differ by one

One count may include the header and the other may count data records only. For example, 100,000 data records plus one header row occupy 100,001 worksheet rows. Compare like with like before assuming anything is missing.

The counts differ by more than one

Check for filters and hidden rows first. If those are not the cause, Excel and the other reader may be interpreting the CSV differently. A CSV uses commas to separate fields and quotation marks to enclose values that contain commas or line breaks. If quotes are missing or damaged, a reader may split one record into several rows or combine rows unexpectedly.

The file has fewer records than physical lines

This can be normal. A quoted field may contain a line break, so one CSV record spans two or more lines in a basic text view. Count parsed records, not the number of visible line breaks in a text editor.

How to fix the count

  1. Count the header separately. Write down whether each count includes the column-name row. Compare data rows with data rows, or worksheet rows with worksheet rows.
  2. Clear filters and unhide rows. In Excel, clear any active filter and check for manually hidden rows. A filtered sheet can contain every record while showing only some of them.
  3. Import the CSV with the right format settings. In Excel for Windows, use Data › From Text/CSV. In Excel for Mac, use Data › Get Data › From Text/CSV if that option is available in your version. In the import preview, choose the file's actual delimiter, usually a comma, and set the quotation mark as the text qualifier. Check the preview before loading the data.
  4. Check quoted fields and line breaks. A quote inside a quoted value is usually written as two quotes, like "". A line break inside a field must remain inside a correctly quoted value. If the file does not follow a consistent format, ask the person or system that created it to export it again.
  5. Keep oversized data out of a single worksheet. If the CSV exceeds Excel's row limit, do not expect one sheet to show every record. Use Power Query or another data-analysis tool to work with the full file, or split it into smaller files before opening it as worksheets. Keep a copy of the original.
  6. Compare the same version of the file. If the row count changes after saving or exporting, check that Excel and the CSV Editor are opening the same path and latest copy. A file exported with a filter or a selection may contain fewer records than the original.

Why CSV rows are not always file lines

A CSV file is plain text, but its rows are records, not simply each line break in the file. For example, a customer's address or a note may include a line break inside quotation marks. A CSV-aware reader treats that as part of one cell. A simple line counter may count it as a new line, while Excel and a CSV editor parse it as part of the existing record.

This is also why opening a CSV by double-clicking can be less predictable than importing it. An import lets you review how Excel will separate fields and interpret quoted text before the data reaches the worksheet.

The CSV Editor works in your browser, and files you open stay on your device.