How to open a large CSV file on a Mac
Double-click a big CSV on a Mac and it usually opens in Numbers, which then crawls or gives up. Here’s what each built-in option can handle, the Terminal commands that work on a file of any size, and how to stop spreadsheets from quietly changing your data.
Short answer: under a million rows, Numbers or Excel will open it, with the caveats below. Bigger than that, look at it with less -S or head in Terminal, query it with the sqlite3 that comes with macOS, or split it into pieces. All of that is free.
First, how big is it?
Open Terminal (in Applications > Utilities) and ask. To fill in a file’s path, type the command and a space, then drag the file into the Terminal window.
ls -lh ~/Downloads/orders.csv
wc -l ~/Downloads/orders.csv
ls -lh shows the size in megabytes or gigabytes. wc -l counts lines, which is the number of rows plus one for the header. If some values contain line breaks inside quotes, there are fewer rows than lines, but it’s close enough to decide what to do next.
Numbers and Excel: the limits
| App | Most rows | Most columns |
|---|---|---|
| Numbers | 1,000,000 | 1,000 |
| Excel for Mac | 1,048,576 | 16,384 |
Past the row limit, Excel opens the first 1,048,576 rows and warns that the file wasn’t loaded completely; the rest is simply missing. Numbers can’t put more than a million rows in a table either. Well before either limit, both get slow: a few hundred thousand rows with many columns is enough to make scrolling and sorting painful.
They change your data on the way in
This matters more than speed. A spreadsheet imports a CSV and converts what it thinks are numbers and dates:
- ZIP codes and account numbers lose their leading zeros:
02134becomes2134. - Long IDs, such as 16- or 18-digit order numbers, are rounded to 15 significant digits and shown as
1.23457E+15. - Text that looks like a date becomes one:
3-4turns into 4 March.
In Excel you can prevent this by importing instead of opening: choose Data > Get Data > From Text/CSV (Microsoft 365) or File > Import, and set the affected columns to Text. Numbers has no import options. In either app, never save over the original CSV: the changed values are what gets written back.
Why Quick Look shows plain text
Select a CSV in the Finder and press Space, and you get raw text: commas, quotes and all. macOS has no table view for CSV files built in.
For years the fix was a free Quick Look plugin, a .qlgenerator file in ~/Library/QuickLook, such as QuickLookCSV. Apple deprecated that plugin format long ago, and macOS 15 Sequoia stopped loading those plugins altogether. They still sit in the folder but do nothing. A table preview on macOS 15 and later has to come from a Quick Look extension that’s built into an app.
Look at it in Terminal
These commands come with every Mac and read the file as they go, so they work the same on a 5 KB file and a 5 GB one. Replace orders.csv with your file.
The first and last rows
head -n 20 orders.csv
tail -n 20 orders.csv
A numbered list of the columns
head -n 1 orders.csv | tr ',' '\n' | cat -n
Scroll through the whole file
less -S orders.csv
less opens instantly at any size because it only reads what’s on screen. -S stops long rows from wrapping; use the arrow keys to scroll sideways. Type / and a word to search, n for the next match, G to jump to the end (that one reads the whole file, so give it a moment) and q to quit.
Line the columns up
head -n 200 orders.csv | column -s, -t | less -S
column -s, splits on commas and -t lines the values up as a table. Run it on the first rows with head: column reads everything before it prints anything, so on a big file it would sit there for a long time.
Two catches. The column in macOS treats several commas in a row as one, so an empty value shifts the rest of the row left. And it doesn’t understand quotes, so a comma inside a quoted value starts a new column. For a quick look you can work around the first one:
head -n 200 orders.csv | sed 's/,,/, ,/g; s/,,/, ,/g' | column -s, -t | less -S
For a tab-separated file, use column -s $'\t' -t.
Find rows
grep -i "acme" orders.csv | head -n 20
grep -ci "acme" orders.csv
The first shows matching rows, the second counts them.
Garbled accents?
file -I orders.csv
iconv -f WINDOWS-1252 -t UTF-8 orders.csv > orders-utf8.csv
file -I reports the text encoding. Exports from older Windows software are often Windows-1252 (shown as iso-8859-1 or unknown-8bit); iconv converts a copy to UTF-8.
Query it with sqlite3
Every Mac has SQLite, a full database, in Terminal. It imports a CSV properly, quotes and all, and then you can ask questions in SQL.
sqlite3 orders.db
.import --csv orders.csv orders
.mode box
SELECT count(*) FROM orders;
SELECT status, count(*) FROM orders GROUP BY status;
SELECT * FROM orders WHERE customer LIKE '%acme%' LIMIT 20;
.quit
The first row becomes the column names, and every value is stored as text, so leading zeros survive. To sort numerically, cast: ORDER BY CAST(total AS REAL) DESC. Importing a file of a few gigabytes takes a few minutes, and orders.db ends up about as big as the CSV; delete it when you’re done.
csvkit, if you have it
csvkit is a free set of command-line CSV tools. Install it with brew install csvkit if you use Homebrew, or pipx install csvkit.
csvcut -n orders.csv
csvcut -c id,date,total orders.csv | head -n 30 | csvlook -I
csvgrep -c status -m refunded orders.csv | csvlook -I | less -S
csvstat -c total orders.csv
csvcut -n lists the columns, csvcut -c picks some, csvgrep filters rows by a column, and csvstat summarizes. Add -I to csvlook so it shows values as they are instead of reinterpreting them. csvkit parses quotes correctly but is written in Python, so it’s slow on large files; trim with head first, and expect csvstat on a gigabyte file to take a while.
Split it so a spreadsheet can open it
If you need the data in Excel or Numbers, cut it into pieces under the limit, each with the header row:
tail -n +2 orders.csv | split -l 900000 - part-
for f in part-??; do { head -n 1 orders.csv; cat "$f"; } > "$f.csv" && rm "$f"; done
You get part-aa.csv, part-ab.csv and so on, 900,000 rows each. This splits on lines, so if any values contain line breaks inside quotes, a row can be cut in two at a boundary; check the first and last rows of each piece.
A text editor that handles big files is another option for a quick read. BBEdit opens multi-gigabyte files and can be used free without buying it; TextEdit is fine for small files only.
The faster way: Comma
If CSVs land on your desk every week, Comma does the above in a window. It opens a file of any size and shows the first rows immediately, keeps leading zeros and long IDs exactly as they are, sorts, filters and summarizes columns, and brings back a real table when you press Space in the Finder on macOS 15 and later. It never changes your file. $10 after a 14-day free trial.