How to merge multiple CSV files into one
The fastest way: drop your files into the merger above, click Download merged CSV. The tool handles header alignment automatically — even if your files have different column orders, it figures out the right mapping. Runs entirely in your browser — no upload.
- Drop your CSV files. Drag any number of
.csvfiles onto the upload area, or click to pick multiple. The tool keeps reading whatever you add. - Pick the header strategy. Three options:
- First file’s headers — assumes every file shares the same columns in the same order (fastest, smallest output).
- Union of all headers — combines every column from every file. Missing values become blank cells.
- Strict match — fails loudly if any file has different headers, so you catch problems early.
- (Optional) Add a
sourcecolumn. Tick the box and the merged file gets an extra column showing which original file each row came from — handy for audit trails. - Click Download merged CSV. A single combined file saves to your downloads folder.
Need to merge differently-shaped files? Inspect each one first with our CSV viewer to compare headers before merging.
How to merge CSV files in Excel
If you’d rather stay inside Excel, there are two ways. Both work but get tedious past 3-4 files — at which point the merger above is faster.
Method 1: Manual copy and paste
- Open the first CSV in Excel — that becomes your master file.
- Open the second CSV in a separate window.
- Select all rows except the header row in the second file → Copy.
- In the master file, click the cell below the last row of data → Paste.
- Repeat for each remaining file.
- Save the master file as
merged.csv(use CSV UTF-8 (Comma delimited) — see comma-delimited CSV for why).
Quick for 2-3 files. Brittle when columns are in different orders, since Excel just stacks rows blindly.
Method 2: Power Query (Excel 2016+)
This is the Excel-native answer when you have many files in the same folder:
- Put all your CSVs in a single folder.
- In Excel: Data → Get Data → From File → From Folder.
- Browse to the folder and click OK.
- Excel lists every file in the folder. Click Combine → Combine & Load.
- In the dialog, pick the example file (Power Query uses it as the schema template) → OK.
- Excel creates a single table with all rows from all files, plus a
Source.Namecolumn showing the original filename. - Save the resulting sheet as a CSV.
Power Query handles differing column orders well. The downside: it’s a multi-step setup, and the resulting workbook needs a manual Refresh whenever the source files change. The merger above runs in 5 seconds with no ceremony.
How to merge CSV files using the command line
For developers, the fast path is the terminal. Two common approaches:
Same-shape files: cat (Unix/macOS)
# Take the header from file1, then append all rows (no headers) from each file.
head -n 1 file1.csv > merged.csv
for f in file*.csv; do tail -n +2 "$f" >> merged.csv; done
Works when every file has identical columns in the same order. Multi-GB files are no problem.
Different shapes: csvkit or pandas
# csvkit (handles different column orders, quoted fields)
csvstack file1.csv file2.csv file3.csv > merged.csv
# Python pandas (most flexible)
python -c "
import pandas as pd, glob
pd.concat([pd.read_csv(f) for f in glob.glob('file*.csv')]).to_csv('merged.csv', index=False)
"
csvstack is the cleanest CLI option and properly handles edge cases. pandas.concat lets you customize the merge logic (inner join on columns, outer join, etc.).
How to merge CSV files for Excel (so they open cleanly)
After merging, the resulting file should open cleanly in Excel — but only if the delimiter and encoding are right.
- Delimiter: Excel uses your locale’s list separator. If your input files use commas but you’re on a French Windows install, the merged file won’t open right. Fix it with our delimiter converter before opening.
- Encoding: save the merged file as UTF-8. Latin-1 or Windows-1252 inputs that contain accents (é, ñ, ü) will produce garbled characters.
Once those are right, double-click the merged file and Excel imports it normally. Want a polished printable version? Convert it to PDF with our CSV to PDF tool or to a real workbook with CSV to Excel.
Common merge problems
”The merged file has duplicate header rows”
This happens when you used cat *.csv directly without skipping headers. Use the head + tail approach above, or use the merger at the top of this page (which strips duplicate headers automatically).
”My columns are out of order in some files”
Different exports sometimes shuffle columns. Pick the Union of all headers option in the merger above and the tool aligns them by column name, not column position. Missing values become blank cells.
”Some rows have extra fields”
A row containing an unescaped comma can split into “extra” columns mid-merge. Open the file in our CSV viewer first; if you see ragged rows, the source file has escaping bugs that need fixing before merging.
”How do I know which row came from which file?”
Tick the Add source column option in the merger above — every row gets tagged with the original filename. Excel’s Power Query method (above) does the same automatically via Source.Name.
”I have hundreds of files”
The browser-based merger handles up to ~100 files smoothly, depending on size. Past that, drop to the command line — csvstack *.csv > merged.csv scales to thousands of files without breaking a sweat.
After merging: cleanup tools
Most merge jobs need a follow-up step:
- Remove duplicate rows — likely after merging customer lists or tracking exports. (Coming soon to csvquick.)
- Sort by a column — order the combined data by date, ID, or name. (Coming soon.)
- Convert to Excel — share a polished workbook with non-technical recipients.
- Convert to PDF — locked-layout snapshot for archival or printing.
- Convert to JSON — feed the merged data into an API or a database import.
Privacy: nothing is uploaded
The merge runs entirely in your browser using PapaParse. Files are read from your disk into memory, combined, and the result is offered back to you as a download. Nothing is sent to a server. Open DevTools → Network and you’ll see no upload request — useful when you’re merging customer data, financial records, or anything sensitive.
Related tools
Convert any CSV file to a real .xlsx Excel workbook in seconds. Free, no signup, files never leave your browser.
Turn any .xlsx or .xls Excel file into a clean CSV. Pick the sheet, pick the delimiter, download. No upload.
Convert any Excel workbook (.xlsx or .xls) to a printable PDF in seconds. Pick the sheet, pick orientation, download. 100% private.
Convert any CSV file to a clean PDF table in seconds. Free, no signup, files never leave your browser.
Frequently asked questions
- How do I merge multiple CSV files into one?
Drop the files into the merger above — one or many — pick a header strategy, click Download merged CSV. The tool aligns columns automatically even when headers differ.
- Can I merge CSV files in Excel?
Yes, with manual copy/paste for 2-3 files, or with Power Query (Data → Get Data → From File → From Folder) for many files. The tool above does the same job in one step without setup.
- What if my CSV files have different columns?
Pick the 'Union of all headers' strategy. The merged file will include every column from every file; missing values become blank cells. Use 'Strict' if you want to be alerted when files don't match.
- Can I add a column showing which file each row came from?
Yes — tick the 'Add source column' option and the merged file gets a 'source' column with the original filename for every row. Useful for audit trails and debugging.
- How many files can I merge?
The browser-based merger handles around 100 files smoothly, depending on size. For thousands of files, drop to the command line: csvstack *.csv > merged.csv.
- Are duplicate header rows removed?
Yes. PapaParse strips the header row from every file automatically — only the first file's columns become the master header (or the union of headers, if you pick that strategy).
- Is my data uploaded?
No. The merge runs entirely in your browser using PapaParse. Files are read from your disk into memory, combined, and the result is offered as a download. Nothing reaches a server.