Skip to content

Data engineering

How to Open and Split Large CSV Files Without Excel

How to open a .csv file too large for Excel, preview a multi-gigabyte CSV, and split a CSV file into multiple files by rows or size, keeping the header in each.

By Asad Ali, IT Support EngineerSC-200 · ISC2 CCPublished 8 min read
How to Open and Split a Large CSV File: Excel 1,048,576-Row Limit, Streaming Preview and Splitting Into Parts With the Header Repeated
How to Open and Split a Large CSV File: Excel 1,048,576-Row Limit, Streaming Preview and Splitting Into Parts With the Header Repeated

To open a large CSV file, preview it with a streaming viewer that reads only the first rows, or split it into smaller files that Excel and other tools can handle. Excel stops at 1,048,576 rows, so SIEM exports, firewall logs and database dumps regularly exceed what a spreadsheet can open.

This guide explains how to open a .csv file in common apps, why big ones fail, and how to split a CSV file into multiple files by row count or size without breaking rows. The examples use the large CSV viewer and splitter, which works on files of several gigabytes inside your browser.

How do you open a .csv file?

Double-click it to open in Excel, Numbers or LibreOffice Calc, or import it with an explicit delimiter and encoding when the columns come out wrong.

A CSV file is plain text: one record per line, fields separated by a delimiter, and fields that contain the delimiter wrapped in double quotes. Opening it by double-click guesses the delimiter and encoding from your system locale, which is why a comma-separated file can land in a single column on a machine set to a locale that uses semicolons.

  1. In Excel, use Data → From Text/CSV rather than double-clicking.
  2. Choose 65001: Unicode (UTF-8) as the file origin so accented and non-Latin characters survive.
  3. Set the delimiter explicitly (comma, semicolon, tab or pipe) and check the preview.
  4. Set ID columns to Text so leading zeros and long numbers are not mangled.

Why can Excel not open a large CSV file?

Excel has a hard limit of 1,048,576 rows and 16,384 columns per sheet, and it often runs out of memory on wide files well before that.

Row and size limits of common tools
ToolLimitWhat happens beyond it
Microsoft Excel1,048,576 rows × 16,384 columnsWarns and drops the remaining rows
Google Sheets10,000,000 cells per spreadsheetImport fails
Apple Numbers1,000,000 rows per tableImport fails or truncates
LibreOffice Calc1,048,576 rows (default)Drops the remaining rows
Text editorsAvailable memoryVery slow or crashes on multi-GB files

Excel silently losing rows is the dangerous case: an incident timeline built from a truncated export looks complete but is missing everything after row 1,048,576.

How do you open a large CSV file without Excel?

Use a streaming viewer that reads only the beginning of the file, or a command-line tool such as head, csvkit or DuckDB, so the file never has to fit in memory.

The large CSV viewer reads only the first 2 MB to show columns and the first 500 rows, with the delimiter detected automatically. It opens a 5 GB file as quickly as a 5 MB one, because the rest of the file is not touched until you split it.

Inspect a large CSV from the terminal
# First 20 lines, aligned
head -n 20 big.csv | column -s, -t

# Count data rows (exact only when no field contains a line break)
echo $(( $(wc -l < big.csv) - 1 ))

# Query it with SQL, no import step
duckdb -c "SELECT action, count(*) FROM 'big.csv' GROUP BY action"

How do you split a CSV file into multiple files?

Choose a number of rows or a size per part, keep the header row in each part, and make sure the splitter ends parts on complete rows outside quoted fields.

  1. Drop the file into the CSV splitter and check the preview.
  2. Pick By row count (for example 50,000 rows) or By file size (for example 25 MB).
  3. Leave First row is a header ticked so every part starts with the column names.
  4. Click Split, then download each part or all of them as one zip.

The splitter scans the raw bytes for line breaks that sit outside double quotes, so a field such as a multi-line ticket comment stays inside one row. Each part is built from the header plus a slice of the original file, which keeps memory use flat even for files of several gigabytes.

number of parts = ⌈ data rows ÷ rows per part ⌉ e.g. 2,350,000 rows ÷ 1,000,000 = 3 parts for Excel

Split by size when the limit you are working around is an upload or attachment cap rather than Excel. A ticketing system that accepts 25 MB attachments, or a SIEM import job capped at 100 MB, is easier to satisfy with By file size, which ends each part on the last complete row before the limit. Split by rows when the parts are meant for people, because "rows 1 to 50,000" is easier to reason about than a byte range.

How do you split a CSV on the command line?

Use split -l for simple files and repeat the header yourself, but switch to a CSV-aware tool when fields can contain line breaks.

Split with coreutils, keeping the header
tail -n +2 big.csv | split -l 50000 -d - part_
for f in part_*; do
  { head -n 1 big.csv; cat "$f"; } > "$f.csv" && rm "$f"
done
CSV-aware split with DuckDB
duckdb -c "COPY (SELECT *, (row_number() OVER () - 1) // 50000 AS part FROM 'big.csv') TO 'parts' (FORMAT csv, HEADER, PARTITION_BY (part))"

split -l counts physical lines, so a quoted field with a line break gets cut in half and both parts become invalid. On Windows, PowerShell's Import-Csv is CSV-aware but loads everything into memory, which fails on the very files you need to split.

How do you check that a split CSV is complete?

Add up the data rows in every part and compare the total with the original, then rebuild the file from the parts and compare checksums; both must match exactly.

A split is only useful if nothing was lost or duplicated at the part boundaries. Row counts catch missing records, but only a checksum proves that no quoted field was cut in two or re-encoded on the way. When I tested the splitter on a 400,000-row file full of multi-line quoted fields, the row counts matched Python's csv module and the reassembled parts were byte-for-byte identical to the original.

Verify a split with standard tools
# 1. Row counts: header-aware, safe with multi-line fields
python3 -c "import csv,glob; print(sum(sum(1 for _ in csv.reader(open(f, newline=''))) - 1 for f in sorted(glob.glob('big_part*.csv'))))"
python3 -c "import csv; print(sum(1 for _ in csv.reader(open('big.csv', newline=''))) - 1)"

# 2. Rebuild: first part whole, the rest without their header line
{ cat big_part01.csv; for f in big_part0[2-9].csv big_part[1-9]*.csv; do tail -n +2 "$f"; done; } > rebuilt.csv
shasum -a 256 big.csv rebuilt.csv

The rebuild loop above assumes the default part names and fewer than 100 parts; adjust the globs to your own names. If the hashes differ but the row counts match, compare line endings first: a tool that rewrote CRLF as LF changes every byte position without changing a single row.

How do you convert a large CSV file to Parquet?

Convert files of up to about 300 MB directly in the browser; for anything larger, split the CSV first and convert each part, or let DuckDB stream the conversion from disk.

Reading and splitting stream from disk, but writing Parquet needs the whole table in memory, because each column is encoded and compressed as one block per row group. The CSV to Parquet converter therefore accepts files up to 300 MB and says so when a file is larger. Split the export into parts of a few hundred thousand rows, convert each one, and query the folder of Parquet files together; Athena, Spark and DuckDB all treat a folder of parts as one table.

Once a CSV is open in the viewer, the tool shows only the tabs that make sense for it: open and view, split, and convert to Parquet. The file stays loaded while you move between those tabs, so you can preview, split and convert the same export without picking it from disk three times. Open another file swaps in the next export and switches the tabs to match its format.

Stream a multi-gigabyte CSV to Parquet with DuckDB
duckdb -c "COPY (SELECT * FROM read_csv_auto('big.csv')) TO 'big.parquet' (FORMAT parquet, COMPRESSION zstd, ROW_GROUP_SIZE 500000)"

What else goes wrong with large CSV files?

Wrong encoding, the wrong delimiter, Excel reformatting long numbers and dates, and line breaks inside quoted fields cause most broken imports.

  • Encoding: save and import as UTF-8; a byte-order mark at the start is harmless to most tools.
  • Delimiter: European Excel exports often use semicolons; tab-separated files are safest for text with commas.
  • Numbers: Excel turns 16-digit IDs into scientific notation and drops leading zeros unless the column is Text.
  • Storage: for analysis, convert the CSV to Parquet with the CSV to Parquet converter; it is typically 70–90% smaller and much faster to query.

Log exports are usually step one of a hunt. Once the data is readable, the KQL & SPL builder helps you write the follow-up queries, and the Parquet and JSONL guide covers exports in other formats.

How many rows does a large CSV file have?

Count the line breaks outside quoted fields and subtract the header; wc -l gives the right answer only when no field contains a line break.

The splitter reports the exact number of data rows after its scan, because it already tracks quotes to find row boundaries. For a quick estimate, divide the file size by the size of a typical row: a 2 GB firewall export at about 120 bytes per row holds roughly 17 million rows, sixteen times what Excel can show.

estimated rows ≈ file size in bytes ÷ average bytes per row e.g. 2,000,000,000 ÷ 120 ≈ 16.7 million rows

Frequently asked questions

Preview them with a streaming viewer that reads only the first rows, query them with DuckDB, or split them into parts under 1,048,576 rows for Excel.

Try it in your browser

About the author: Asad Ali

IT Support Engineer and SOC analyst · Microsoft SC-200 & ISC2 CC certified

Asad Ali is an IT Support Engineer and SOC analyst with a Computer Science degree from UET Lahore. He holds the Microsoft SC-200 Security Operations Analyst and ISC2 Certified in Cybersecurity (CC) certifications, works on threat detection, network analysis and Linux administration, and builds and maintains every tool on LocalSecTools.

  • Microsoft Certified: Security Operations Analyst (SC-200)
  • ISC2 Certified in Cybersecurity (CC)

Every guide is written and technically reviewed by Asad Ali, and the commands and numbers are checked against the LocalSecTools calculators. Read more about his work at asadali.tech.

More engineering guides