· CSV.ink Team

How to Split a Large CSV File into Smaller Files

Excel caps out around one million rows, and many upload forms reject multi‑megabyte CSVs. Splitting by row count with a repeated header is usually enough.

A “large” CSV is whatever your next tool refuses. Excel’s classic row limit is 1,048,576. Email gateways and some admin importers choke much earlier. You do not always need a database — often you just need several smaller files with the same columns.

Split by row count (the usual fix)

Keep the header once per output file, then pack N data rows into each chunk. N = 50,000 or 100,000 is a common starting point for Excel-bound files; for picky upload forms, try 5,000–10,000 and raise it until imports succeed.

customers.csv
  → customers_01.csv  (header + rows 1–1000)
  → customers_02.csv  (header + rows 1001–2000)
  → …

Zero-pad the suffix (_01, _02) so the files sort in order in Finder or Explorer.

Split a CSV online by row count →

What not to do

  • Do not cut the file in a text editor in the middle of a quoted field. A field can legally contain line breaks; a blind split corrupts that row.
  • Do not drop the header on chunk 2+. Most importers expect column names on every file.
  • Do not assume byte size maps cleanly to row count — wide rows with long text blow up size faster than narrow ones.

After you process the chunks

If each piece was enriched or cleaned separately, merge them back with the same column union. Keep an optional “source file” column when you need to trace which chunk a row came from.

Merge CSV files →

When splitting is the wrong tool

If you need filters, aggregates or joins across the whole dataset, load it into a database or a proper data frame library instead of shuffling dozens of files. Splitting is for transport and tool limits, not for analysis.

Excel’s million-row wall

If your file has 1.2 million rows, no amount of “open with Excel” will work. Split into chunks under 1,000,000 data rows (plus header), or use a tool that is not Excel. Power Query and many BI tools can stream larger CSVs, but shared office workflows still often assume someone will open the file in desktop Excel — plan for that limit.

Also watch column count. Extremely wide files (hundreds of columns) hit memory limits before they hit the row cap. In that case split by column groups only if your process allows it; otherwise move to a database.

أدوات ذات صلة

← كل المقالات

مزيد من المقالات