Merge CSV files into one
Combine several CSV files into one, with columns matched by name.
- Nothing is uploaded
- Free
- No sign-up
Guide
Merge CSV: the complete guide
Last updated 4 min read
About this tool
PrivateCSV combines two or more CSV files into a single file with one header row. Columns are matched by name, so files whose columns are in a different order, or that have extra or missing columns, still line up. You can also add a source_file column that records which file each row came from. The merge runs in your browser and the files stay on your device.
How to merge CSV files
- Drop the CSV files on the picker, or click it and select several at once (hold Ctrl, or Cmd on a Mac). You can add more files afterwards, reorder them or remove one; they are merged in the order listed.
- Leave “Files have a header row” ticked so columns are matched by name.
- Tick “Add a column with the source file name” if you need to trace each row back to its file, and “Excel-compatible” if the result will be opened in Excel.
- Click Merge CSV files and download merged.csv.
Example
Two exports with different column orders, merged with the source column.
id,name,email
1,Ana,ana@example.com
email,id,name,phone
ben@example.com,2,Ben,555-0102id,name,email,phone,source_file
1,Ana,ana@example.com,,january.csv
2,Ben,ben@example.com,555-0102,february.csvWhen you need it
- Monthly, store or regional exports
- Many tools export one CSV per month, store or campaign: bank statements, order exports, ad reports, survey responses. One merged table is easier to filter, pivot or import.
- Exports whose columns have changed
- When a vendor adds or reorders a column, pasting files under each other silently shifts values into the wrong columns. Matching by header name avoids that.
- Preparing a single import file
- Merge the files, check the result with the CSV validator, then split it again if it is over the platform's import limit.
How columns are matched
The first row of each file is read as its header. The merged file contains every column found in any file, in the order they first appear. Names are compared after removing surrounding spaces and the invisible byte order mark some programs add, so “email” and “ email” are the same column. The comparison is case-sensitive: “Email” and “email” stay separate columns. When a file has no such column, its cells are left empty.
Why copy and paste in Excel goes wrong
Pasting one file under another only works while every file has the same columns in the same order. Excel also changes data as it opens a CSV: 00123 becomes 123, and numbers longer than 15 digits, such as card or order IDs, lose their last digits because Excel keeps 15 significant digits.
This tool treats every value as text and copies it unchanged, so the merged file contains exactly what the source files contained. Tick “Excel-compatible” to add the UTF-8 byte order mark Excel needs to display accented letters correctly; leave it off if the file goes into a database or script.
Limits to know about
- Each file's delimiter is detected automatically. The merged file uses the delimiter of the first file.
- Without a header row, columns cannot be matched by name: rows are appended as they are, so the files must share the same column order. The source column needs headers too.
- Rows with more cells than their file's header lose the extra cells. The result tells you how many rows were affected.
- The merged file is assembled in your browser's memory, so the total size you can merge depends on your device.
Frequently asked questions
How do I combine multiple CSV files into one?
Add the files to the picker and click Merge CSV files. The rows of each file are appended in the order listed, under a single header row, and you download one merged.csv.
How do I combine CSV files with pandas in Python?
Read each file and stack them with pd.concat([pd.read_csv(f, dtype=str) for f in files], ignore_index=True), then save with .to_csv("merged.csv", index=False). concat matches columns by name, like this tool; pd.merge is for joining two tables on a key column, not for stacking rows. dtype=str keeps values such as 00123 unchanged.
What if my CSV files have different columns?
The merged file contains every column that appears in any file. Values are placed by header name, and a file that lacks a column gets empty cells there.
How do I merge CSV files in Excel or with the command prompt?
In Excel, Data > Get Data > From File > From Folder loads a folder of CSV files into Power Query, which can combine them in a few steps; the result is still limited to 1,048,576 rows. In Windows Command Prompt, copy *.csv merged.csv joins files byte by byte, which repeats every header and ignores column order.
Will merging change ZIP codes or long ID numbers?
No. Every value is copied as text, so 00123 stays 00123 and a 16-digit ID keeps every digit. Those changes usually happen later, when a CSV is opened by double-clicking it in Excel. Use Data > From Text/CSV and set the column type to Text to avoid them.
Can I see which file each row came from?
Yes. Tick “Add a column with the source file name” and the merged file gets a final source_file column with the original file name on every row.
Related tools
Go further
Your files never leave your device
PrivateCSV runs every tool inside your browser. No upload, no account, nothing to install.