How to open a CSV file that’s too big for Excel (more than 1,048,576 rows)
By MegaRows · Published · 8 min read
You double-click a CSV export, Excel thinks for a while, and then warns you that the file was not loaded completely. The file itself is fine: Excel simply cannot show more than 1,048,576 rows on a sheet. This guide explains what happens to the rest of your data and walks through six ways to work with the whole file, from tools you already have to ones that need a little code.
Why Excel stops at 1,048,576 rows
Since Excel 2007, every worksheet has exactly 1,048,576 rows (220) and 16,384 columns, up to column XFD. The older .xls format topped out at 65,536 rows. The limit is built into Excel’s grid and file format, so no setting, add-in or faster computer raises it. It is the same in Microsoft 365 on Windows and Mac and in Excel on the web.
Other spreadsheets have similar ceilings. LibreOffice Calc also stops at 1,048,576 rows by default, and Google Sheets allows 10 million cells per spreadsheet, so a file with 20 columns maxes out at 500,000 rows.
The CSV format itself has no row limit. It is plain text, and a database export, web log or sensor recording can easily run to tens of millions of lines and several gigabytes. The problem is never the file: it is the program you open it with.
What you see when Excel truncates a CSV
When a CSV has more lines than the grid can hold, Excel loads the first 1,048,576 (header included) and shows a warning. Depending on your version, it says “File not loaded completely” or “This data set is too large for the Excel grid. If you save this workbook, you’ll lose data that wasn’t loaded.” Click OK and you get a normal-looking spreadsheet that is missing everything after row 1,048,576.
- Check whether you were cut off. Click a cell in column A and press
Ctrl+↓. If you land on row 1,048,576, the file was almost certainly truncated. Totals, counts and pivot tables then quietly cover only the loaded rows. - Don’t save over the original. If you save the truncated workbook as CSV under the same name, the missing rows are gone from disk for good. Keep the original export untouched and work on a copy.
- Watch for silent conversions. Excel strips leading zeros from codes and phone numbers, turns long IDs into scientific notation (it keeps only 15 significant digits) and reinterprets dates using your regional settings. Recent Microsoft 365 versions let you switch some of this off under File › Options › Data › Automatic data conversion.
First, count the rows
Before choosing a tool, find out how big the problem is. A file with 1.2 million rows needs a different approach from one with 80 million. You can count the lines right here without opening the file in a spreadsheet. It is read on your device and never uploaded:
Instant row counter
Count the lines in a CSV, TSV or TXT file of any size.
Drag and drop a file here
CSV, TSV or TXT, any size. Millions of lines are fine.
Your file never leaves your device. It is read by your browser in a background thread. Nothing is uploaded.
On the command line, wc -l data.csv (macOS and Linux) or find /c /v "" data.csv (Windows Command Prompt) gives the same answer. Remember that the count includes the header line, and that a value with a line break inside quotes spans more than one line. Our CSV row counter page explains the difference between lines and records.
Option 1: Split the CSV into smaller files
If you need the data in Excel itself, split the file into parts that each fit under the limit, with the header row repeated at the top of every part. At 1,000,000 data rows per file, a 3.4-million-row CSV becomes four files. On macOS or Linux (or on Windows through WSL or Git Bash):
# Keep the header, split the rest into parts of 1,000,000 lines
tail -n +2 data.csv | split -l 1000000 - part_
for f in part_*; do
{ head -n 1 data.csv; cat "$f"; } > "$f.csv" && rm "$f"
donePros: every part opens normally in any version of Excel; no new software for most people.
Cons: sorting, filtering and totals across parts are painful; a plain line-based split can cut a record in half if values contain quoted line breaks.
A MegaRows CSV splitter that repeats the header and respects quoted line breaks is coming soon.
Option 2: Power Query and the Data Model
Excel can work with far more rows than the grid shows, as long as you keep them out of the grid. Power Query loads the CSV into the Data Model, a compressed in-memory database inside the workbook, and PivotTables and PivotCharts then summarise all of the rows. In Excel for Windows:
- Go to Data › Get Data › From File › From Text/CSV and choose the file.
- In the preview window, click the arrow next to Load and choose Load To…
- Select Only Create Connection, tick Add this data to the Data Model and click OK.
- Use Insert › PivotTable › From Data Model to summarise the full data set.
Power Query can also filter and clean the data before it loads. If you only need last year’s orders or a handful of columns, the result may fit in the grid after all. Power BI Desktop, a free Windows app, uses the same engine.
Pros: stays in Excel; handles tens of millions of rows, limited by memory; refreshes when the CSV changes.
Cons: you can’t scroll through the rows; the Data Model is only fully supported in Excel for Windows; big models make workbooks slow.
Option 3: Load it into a database
Databases are built for millions of rows. Two free options need no server and install in a minute: DuckDB, which queries CSV files directly, and SQLite, which imports them into a single database file.
-- DuckDB: query the CSV directly, no import step
SELECT count(*) FROM 'data.csv';
SELECT region, sum(amount) FROM 'data.csv' GROUP BY region;
-- SQLite (in the sqlite3 shell): import once, then query
.import --csv data.csv sales
SELECT count(*) FROM sales;Graphical tools such as DBeaver or DB Browser for SQLite give you a spreadsheet-like view of query results.
Pros: very fast; copes with hundreds of millions of rows; results are often small enough to paste into Excel.
Cons: you need to install software and learn basic SQL; it is not a sheet you can scroll and edit freely.
Option 4: Python and pandas
If you are comfortable with a little code, pandas reads a CSV of a few million rows in seconds:
import pandas as pd
df = pd.read_csv("data.csv")
print(len(df)) # data rows, header excluded
print(df.head(20)) # first 20 rows
df[df["region"] == "North"].to_excel("north.xlsx", index=False) # needs openpyxlIf the file is bigger than your memory, process it in chunks:
total = 0
for chunk in pd.read_csv("data.csv", chunksize=1_000_000):
total += chunk["amount"].sum()Polars is a faster alternative with a similar feel, and its lazy scan_csv handles files larger than memory.
Pros: free, very flexible and repeatable; ideal for cleaning, reshaping and automating.
Cons: needs Python and some coding; a DataFrame often uses several times the file size in RAM; no point-and-click grid.
Option 5: Command-line tools
For a quick look, the tools built into macOS and Linux (and available on Windows through WSL or Git Bash) are hard to beat:
head -n 20 data.csv # first 20 lines
tail -n 20 data.csv # last 20 lines
wc -l data.csv # count lines
grep -c "London" data.csv # count lines that contain a wordDedicated CSV tools such as xsv, qsv and csvkit understand quoting and can select columns, sort, filter and compute statistics on files of many gigabytes.
Pros: instant, even on huge files; usually nothing to install; easy to script.
Cons: no grid; head and grep don’t understand quoted fields; less friendly on Windows.
Option 6: Browser-based tools
Online CSV viewers need no installation, but check two things before dropping a large file into one. Many upload your file to their server, which is slow for big files and a problem for confidential data. And many cap the file size or row count well below what you need.
MegaRows takes a different approach: everything runs locally in your browser, so the file never leaves your device. Today it offers the row counter you used above. A viewer for files with millions of rows is coming soon, along with charts, converters and split, merge and compare tools.
Pros: nothing to install, works on any operating system; local tools keep your data private.
Cons: limited by your browser’s memory; many online tools upload data or cap sizes; the MegaRows viewer is not available yet.
Which option should you choose?
| Option | Best for | Install | See every row? | Skill |
|---|---|---|---|---|
| Split the file | Getting the data into plain Excel | None on macOS and Linux | Yes, part by part | Low |
| Power Query | Pivots and summaries in Excel | None (Excel for Windows) | No | Medium |
| DuckDB or SQLite | Filtering and aggregating | Small download | Query results | Medium (SQL) |
| Python and pandas | Cleaning and automation | Python | In code | High |
| Command line | A quick look, counting | Built in (macOS, Linux) | First and last lines | Medium |
| Browser tools | Quick checks without installing | None | Depends on the tool | Low |
If you only need to know how big the file is, count it first. If colleagues need the data in Excel, filter it down with Power Query or split it. If you work with files like this every week, a little DuckDB or pandas pays off quickly.
Frequently asked questions
What is the maximum number of rows in Excel?
1,048,576 rows and 16,384 columns per worksheet, in every version since Excel 2007, including Microsoft 365. The older .xls format allows 65,536 rows.
Can I increase Excel’s row limit?
No. The limit is fixed in Excel’s grid and file format, and no setting or add-in changes it. The workaround inside Excel is to load the data into the Data Model with Power Query, which has no fixed row limit but does not show the rows in the grid.
Does Excel delete the rows it cannot show?
Not from the original file. Excel only loads the first 1,048,576 rows into the workbook. The extra rows are lost only if you save the truncated workbook over the original CSV, so always keep a copy of the export.
Can Google Sheets open a CSV with more than a million rows?
Usually not. Google Sheets allows 10 million cells per spreadsheet, counting every column, so a CSV with 10 columns tops out at 1 million rows and one with 50 columns at 200,000 rows.
How do I open a large CSV file on a Mac?
Apple Numbers and Excel for Mac both stop at around a million rows, and Excel’s Data Model is only fully supported on Windows. The command line (head, wc -l, split), DuckDB, Python and browser-based tools all work well on macOS.
Is it safe to use an online CSV viewer for confidential data?
Only if the file never leaves your computer. Many online tools upload files to their servers. Tools that process data locally in the browser, such as MegaRows, read the file on your device instead, and you can confirm this in the Network tab of your browser’s developer tools.
Related tools and guides
- CSV row counterCount the lines in a CSV, TSV or TXT file of any size. Works today.
- The MegaRows toolboxWhat works today and what is coming next, and why nothing is ever uploaded.
Coming soon to MegaRows: Large CSV viewer · Charts with statistics · CSV, Excel, JSON and PDF converters · Split, merge and compare.