Merge CSV files with matching columns
Monthly exports, one file per store, a list from each colleague: sooner or later you need to merge CSV files into one table. Stacking them with copy and paste breaks as soon as the column order differs or one file has an extra column. This merger lines the columns up by their header names, keeps every column that appears in any file, and shows you a preview before you download. It runs in your browser, so the files are not uploaded.
Matching columns by header name
The merged file contains the union of all columns, in the order they first appear. A file that lacks a column gets empty cells there. For example:
january.csv february.csv
id,name,email name,email,id,phone
1,Ava,ava@example.com Noah,noah@example.com,2,555-0100becomes
id,name,email,phone
1,Ava,ava@example.com,
2,Noah,noah@example.com,555-0100With Ignore case and spaces in header names ticked (the default), “Email ”, “email” and “EMAIL” land in the same column, labelled with the spelling that appeared first. If one file repeats a header name, say two “notes” columns, the first matches the first “notes” column of the other files and the second matches the second.
Matching columns by position
Choose By position when the files have the same layout but different or missing header names: column 1 goes with column 1, and so on. The output header takes each column's first non-empty name, or “Column 3” when no file names it. Files without any header row are always merged by position, and no header row is added to the output.
Source file column and duplicate rows
Add a column with the source file name appends a column (named source_file unless you change it) that tells you where each row came from, which helps when you need to trace a value back later. Remove duplicate rows keeps the first copy of every row whose cells are all identical after the columns are aligned. The source column is ignored in that comparison, so the same row in two files still counts as a duplicate. Values must match exactly: “Ann” and “ann ” are different.
Reading and writing
- Each file's delimiter is detected on its own, so comma, semicolon and tab files can be merged together.
- UTF-8 files (with or without a BOM) and UTF-16 files that start with a BOM are read correctly; files that are not valid UTF-8 are read as Windows-1252.
- Quoted fields with commas, quotes and line breaks are kept intact.
- Choose comma, semicolon, tab or pipe for the output, and tick Add UTF-8 BOM for Excel.
The summary above the preview shows the number of rows in and out, how many duplicates were removed and which files added new columns, so a header typo that creates an unexpected extra column is easy to spot. To go the other way, the CSV splitter breaks a large file into parts. Merged data can be checked in the CSV viewer, and data from spreadsheets or APIs can be turned into CSV first with Excel to CSV or JSON to CSV.