Skip to content

Guides

How to open a CSV file too large for Excel (1 million+ rows)

Why Excel cuts big CSV files off at 1,048,576 rows, and six ways to open, search and work with the whole file instead, from a free browser tool to Power Query and Python.

By Ketan ·

You double-click a CSV, Excel thinks for a while, and then: “File not loaded completely.” Or it opens, but scrolling is painful, and you have a nagging feeling the totals are off. Both have the same cause.

Why Excel can’t open it

An Excel worksheet holds at most 1,048,576 rows and 16,384 columns. When a CSV has more rows than that, Excel loads the first 1,048,576, shows the warning once, and silently drops the rest. If you then save the file, the missing rows are gone for good.

Even below that limit, Excel struggles with big files. It loads the whole file into memory and formats every cell, so a few hundred megabytes can make it crawl. Google Sheets is stricter still: a spreadsheet can hold 10 million cells in total, so 500,000 rows × 20 columns is already the ceiling.

From experience: the dangerous case isn’t the file that won’t open. It’s the one that does open, minus the rows past the limit, and then gets summed, filtered and emailed as if it were complete. If an export might be large, check its row count before trusting any total.

How to check the row count without opening it

  • In the browser: the Large CSV viewer shows the exact row count as soon as the file loads.
  • Mac or Linux: wc -l big.csv counts lines; subtract 1 for the header.
  • Windows PowerShell: (Get-Content big.csv | Measure-Object -Line).Lines. On very large files, the faster version is [System.IO.File]::ReadLines("C:\path\big.csv").Count.

Line counts can be slightly off if some values contain line breaks inside quotes, but they tell you quickly whether you’re near the limit.

1. Open it in your browser (no install)

The Large CSV viewer opens files of several gigabytes in seconds. It uses DuckDB, a database engine that runs inside the page and reads the file from disk in pieces, so the file is never uploaded and never has to fit in memory. You can:

  • search every column at once,
  • sort by any column,
  • see a summary of each column (type, min, max, number of distinct values, share of empty cells),
  • download just the rows that match your search, which is the quickest way to cut a huge file down to something Excel can handle.

2. Query it with SQL

When you need totals, counts or a filtered subset rather than scrolling, SQL is faster than any viewer. SQL on CSV runs in the browser on the same engine:

SELECT region, count(*) AS orders, sum(amount) AS revenue
FROM big
GROUP BY region
ORDER BY revenue DESC;

A query like this over 15 million rows takes a couple of seconds. Download the result, which is now a few rows, and finish the work in Excel.

3. Excel Power Query and the Data Model

Excel can work with more than a million rows, just not on a worksheet:

  1. Go to Data → From Text/CSV and pick the file.
  2. Click the arrow next to Load and choose Load To…
  3. Select Only Create Connection and tick Add this data to the Data Model.
  4. Build a PivotTable from the Data Model.

The rows live in Excel’s compressed data model, so pivots, totals and filters work over the whole file. You still can’t scroll through every row, but for summaries this is the built-in answer, and it refreshes when the file changes.

4. Split it into smaller files

If someone needs the data in Excel row by row, split it into pieces under the limit.

  • Mac or Linux: split -l 1000000 big.csv part_ makes files of a million lines each. Only the first piece has the header row, so add it to the others, or use a tool that repeats it.
  • Python:
import pandas as pd
for i, chunk in enumerate(pd.read_csv("big.csv", chunksize=1_000_000)):
    chunk.to_csv(f"part_{i + 1}.csv", index=False)

Each part keeps the header and opens in Excel. Before you split, ask whether the reader really needs every row. Usually a summary or a filtered subset (options 1–3) is more useful than eight separate files.

5. Process it in Python

For repeatable work, pandas reads a file in chunks so memory stays flat:

import pandas as pd
totals = None
for chunk in pd.read_csv("big.csv", chunksize=500_000, usecols=["region", "amount"]):
    part = chunk.groupby("region")["amount"].sum()
    totals = part if totals is None else totals.add(part, fill_value=0)
print(totals.sort_values(ascending=False))

Or use DuckDB from Python, which does the chunking for you and is usually much faster:

import duckdb
duckdb.sql("SELECT region, sum(amount) FROM 'big.csv' GROUP BY region").show()

6. Look at it in a text editor

To read the first lines, check the separator, or see what a broken row looks like, a text editor is enough, as long as it doesn’t load the whole file at once:

  • Mac or Linux terminal: head -n 20 big.csv shows the first 20 lines, and less big.csv scrolls through any size of file.
  • Windows: large-file viewers like Large Text File Viewer, or recent versions of Notepad++ (64-bit), handle files of a few gigabytes.

Avoid opening a multi-gigabyte file in ordinary Notepad or TextEdit. They try to load all of it and freeze.

Which option to pick

You need to… Use
Look through it, search it, or cut it down Large CSV viewer
Totals, counts, a filtered extract SQL on CSV or Power Query
The same summary every month Power Query (refreshable) or a Python script
Hand row-level data to Excel users Split it, after asking if they really need every row
Check the format or find a broken line head / less, or a large-file text editor