Converter tool

Split CSV by Column Value

Make one CSV for each value in a column, such as one file per region or customer, each with the header row, and download them as a ZIP. Runs in your browser.

Values are compared after trimming spaces and are case-sensitive. Empty cells go to blank.csv. Rows are copied unchanged with the header on top. Limits: 100,000 rows and 200 files per run. The file is parsed and zipped by this browser tab.

Preview

Output Preview

Load a CSV and pick a column to see one row here for each file the split will create.

Split CSV by Column Value

Operator: Abdulla Al Fahad. How tools are built and checked

A sales export with a region column, a payroll file with a department column, a ticket dump with an assignee column: sooner or later someone asks for "just my rows". Filtering the sheet once per value and saving each result by hand works for three regions and becomes a chore at thirty. This tool does that loop for you. Pick the column, and every distinct value in it becomes its own CSV, with the original header row on top, all packed into one ZIP.

The files are named after the value they hold, so the North rows land in North.csv and the rows for customer ACME-04 land in ACME-04.csv. Before you download, the page lists every file it is about to write with its row count, so a stray spelling such as "Nroth" shows up as its own one-row file instead of hiding inside the ZIP.

Key features

  • One CSV per distinct value, header row repeated in every file
  • Column chosen from the file's own headers; a column whose values repeat is pre-selected
  • Values grouped after trimming surrounding spaces, so "South" and " South " share a file
  • Empty cells collected in blank.csv instead of being dropped
  • File names cleaned of / \ : * ? " < > | and cut to 80 characters, with _2, _3 added for clashes
  • Preview table of value, file name and row count before anything is downloaded
  • Rows copied unchanged, in their original order

What each split file keeps from the source

Input is a comma-separated text file whose first line is the header. Quoted fields are understood, including commas and line breaks inside quotes. Semicolon- or tab-separated files are read as one wide column, so re-save them with commas first. UTF-8 and UTF-16 files with a byte-order mark are both accepted.

Each output file repeats the header exactly as it appeared, then the matching rows in their original order. Cell values are kept as written: leading zeros in an ID and spaces inside a value survive, because the tool never converts a cell to a number. Each value is written back with only the quoting that a comma, a double quote or a line break inside it needs, so quotes around a plain word in the source are not repeated. Lines end in CRLF. If your source started with a UTF-8 byte-order mark, every output file starts with one too, which keeps accented names readable when the files are opened in Excel.

A run accepts up to 25 MB, 100,000 data rows and 200 distinct values. When the chosen column would produce more than 200 files, the page says so and builds nothing; that usually means the column is an ID or a date rather than a category.

How it works

The page reads the first 8 KB of the file and refuses it if a NUL byte appears there, since that means a workbook or archive rather than text. A file larger than 25 MB stops there too. After parsing, a file with more than 100,000 data rows is turned away, and so is a column choice that would yield more than 200 groups; in both cases no ZIP is built. The parser keeps every cell value exactly as written.

For the column you pick, each row's cell is trimmed and used as a grouping key. Groups are kept in the order their value first appears, so if the first data row is West, West.csv is listed first. A row that is too short to reach the column counts as empty and goes to the blank group.

File names are made last. The blank group claims blank.csv first; a real cell that says "blank" then becomes blank_2.csv, so the two are never merged. Each other value has path and wildcard characters swapped for underscores, trailing dots removed, and Windows device names such as CON given a trailing underscore. Clashes are checked without regard to letter case, because Windows and macOS treat north.csv and North.csv as the same file and would overwrite one with the other during extraction.

When you press Download ZIP, JSZip writes each group's header and rows into a compressed archive inside the tab, and the browser saves it as yourfile-by-column.zip.

Common use cases

  • Sending each regional manager a file with only their region's orders
  • Giving every client a CSV of their own invoices from one billing export
  • Breaking a combined payroll export into one file per department for separate approval
  • Splitting a support ticket export by assignee before a weekly review
  • Preparing one import file per warehouse when each site loads its own stock list

How to use this tool

  1. Load the CSV you want to break up (or press Use sample data for a six-order file), then decide which column to group by: the one whose values should become file names.
  2. Check the Split by column menu. Change it if the pre-selected column is not the one you want.
  3. Read the preview: one row per file, with the value, the file name and how many rows it will hold.
  4. If a value looks misspelt or a group is unexpectedly large, fix the source file and load it again.
  5. Press Download ZIP and extract it. Each file opens in common spreadsheet apps with the header in row 1; as plain CSV it carries no column widths, colours or number formats.

Example

orders.csv, split by region (6 data rows)

order_id,region,rep,amount
1001,North,Imani,420.00
1002,South,Tomasz,96.50
1003,North,Imani,1310.00
1004,,Priya,75.00
1005,West,Priya,288.40
1006,South,Tomasz,640.00

orders-by-region.zip (4 files)

North.csv  2 rows: 1001, 1003
South.csv  2 rows: 1002, 1006
blank.csv  1 row:  1004
West.csv   1 row:  1005

North.csv:
order_id,region,rep,amount
1001,North,Imani,420.00
1003,North,Imani,1310.00

Tips for best results

  • Pick a column that names a category. If the preview shows hundreds of one-row files, you picked an ID column.
  • Look down the preview for near-duplicates such as "N. America" and "North America"; each becomes its own file.
  • If you need the files to sort in a set order, add a prefix to the values in the source first, such as 01-North.
  • Keep the ZIP name: it records which column the split used, which helps when you split the same export two ways.
  • For a file over 100,000 rows, cut it by row ranges first, split each part, then merge the matching files.

Common pitfalls

Grouping is case-sensitive. "north" and "North" are separate groups, and because file systems ignore case, the second one is saved as North_2.csv. Make the values consistent in the source if they should be one file.

Only spaces at the edges of a value are ignored. A non-breaking space or a trailing tab pasted from a web page still makes a separate group, and the preview is the place to spot it.

Two values that differ only in characters the file system forbids, such as A/B and A:B, both clean to A_B and are saved as A_B.csv and A_B_2.csv. The preview shows which value went to which file.

Rows with fewer cells than the header are copied as they are, not padded. A spreadsheet will show the missing cells as empty, but a strict importer may reject the row.

The tool splits on one column. To split by region and then by rep, run it once, then run each regional file again on the rep column.

Common errors and how to fix them

"This looks like a binary file, not a text CSV. Choose a CSV file."
The splitter found a NUL byte near the start, which plain comma-separated text never contains, so it stopped before grouping anything. The usual cause is an Excel workbook or a ZIP that was given a .csv name. Export the sheet you want as CSV from your spreadsheet app and load that file, or split the workbook into sheet files first.
The page says the column has more than 200 different values.
Pick a column with fewer distinct values, or group the values first (for example, add a month column next to a date column and split on that).
The page says the CSV has more than 100,000 data rows.
Cut the file into parts by row number, split each part on the same column, and combine files with the same name afterwards.
Every row ends up in a single file named after the whole line.
The file uses semicolons or tabs between fields. Re-save it as comma-separated and load it again.

Best practices

  • Clean the grouping column before splitting: one spelling, one case, no stray spaces.
  • Check the total of the preview row counts against the data row count shown above the column menu.
  • Open blank.csv before sending anything out; it often holds rows that need an owner assigned.
  • Keep the original file next to the ZIP so the split can be repeated after a correction.

How file names are chosen

The name comes from the trimmed cell value. Characters that Windows or macOS refuse in a file name (slash, backslash, colon, asterisk, question mark, double quote, angle brackets and the vertical bar) become underscores. Trailing dots and spaces are removed because Windows silently drops them. Names longer than 80 characters are cut, so a long product description still gives a usable file name.

A value that cleans to nothing, such as a cell holding only dots, is saved as _.csv. Duplicate names get _2, _3 and so on, and the suffix never pushes a name past 80 characters.

Why empty cells get their own file

Dropping rows with no value in the split column would make the files add up to fewer rows than the source, and nobody would notice until a total failed to reconcile. Putting them in blank.csv keeps every row accounted for and turns the gap into a list of records that need fixing.

Frequently asked questions

Is the header repeated in every file?

Yes. Each file starts with the original header line, copied exactly, followed by that group's rows.

Can I split on a column that has no header name?

Yes. It appears in the menu as "column 3, no header" (with its position), and the ZIP name uses column-3.

Are the rows sorted inside each file?

No. Rows keep the order they had in the source, so a file of North orders is still in order-date order if the source was.

Where does the ZIP get built?

The CSV is read with the browser's file API and the archive is assembled by JSZip in the same tab, then saved through a temporary object URL that is released a second after the download starts.