How to Merge Multiple Excel & CSV Files Into One (Free Tool + Steps)

Merge multiple Excel and CSV files tutorial showing Power Query folder import data consolidation and automated refresh
Combine multiple Excel workbooks and CSV files into a single dataset with Power Query. This tutorial explains how to import files from a folder, merge data automatically, transform and clean records, handle different file structures, refresh combined data, and create scalable reporting workflows. Ideal for Excel users, analysts, accountants, operations teams, and business professionals who regularly consolidate data from multiple sources.

Key takeaways

  • The fastest way to combine multiple CSV files into one is a folder-based tool, not manual copy-paste, which breaks when files have different columns.
  • Excel/CSV Merger is free and open-source (MIT licensed), built in Python with pandas and openpyxl.
  • It merges Excel files with different columns by keeping the union of all columns — mismatched files no longer cause errors or lost data.
  • Each row gets a source_file tag, so you always know which spreadsheet it came from.
  • One command handles a whole folder, including sub-folders, and outputs either .xlsx or .csv.

To merge multiple Excel files into one, put every .xlsx and .csv file in a single folder and run a free command-line tool called Excel/CSV Merger, which combines them into one clean spreadsheet in seconds. It automatically lines up columns that don't match, labels every row with the file it came from, and can remove duplicate rows — no copy-pasting and no manual cleanup.

The problem: combining many spreadsheets by hand

Almost every office job produces the same headache: a folder full of spreadsheets that need to become one. Monthly sales exports, form responses split across files, reports from different team members, data pulled from separate systems — each arrives as its own .xlsx or .csv.

The usual "solution" is to open each file, copy the rows, and paste them into a master sheet. This is slow, and it silently goes wrong the moment two files have different columns or column orders. Rows land in the wrong place, headers get duplicated, and you lose track of which file a record came from. On 30 or 40 files, it's an afternoon gone.

What is Excel/CSV Merger?

Excel/CSV Merger is a free, open-source command-line tool that combines every Excel and CSV file in a folder into one clean file. It's written in Python and released under the MIT license, so anyone can use it at work or in their own projects at no cost.

Instead of copy-pasting, you point it at a folder and it does four things automatically:

  • Reads every .csv, .xlsx and .xls file in the folder.
  • Aligns mismatched columns by keeping the union of all column names.
  • Tags each row with a source_file column.
  • Optionally removes duplicate rows with a single flag.
january.csv id · customer · amount 3 rows february.xlsx id · customer · amount · region 3 rows · extra column march.csv id · customer · amount Excel/CSV Merger 1 command merged_output.xlsx source_file · id · customer amount · region 9 rows · all columns aligned blank region for Jan & Mar ✓ duplicates removed
How Excel/CSV Merger combines files with mismatched columns into one aligned, tagged output file.

How to install the tool (2 minutes)

You need Python 3.9 or newer. Then clone the repository and install its two dependencies:

git clone https://github.com/Synth88Labs/excel-tool-merger.git
cd excel-tool-merger
pip install -r requirements.txt

That's the whole setup. The tool uses only pandas and openpyxl — both trusted, widely used Python libraries.

Get Excel/CSV Merger on GitHub (free)

How to merge multiple Excel files into one — step by step

Once installed, combining a folder of files is a single command. Here's the full workflow.

Step 1 — Put your files in one folder

Collect every spreadsheet you want to combine into a single folder, for example ./reports. They can be a mix of .csv, .xlsx and .xls files — you don't need to make them match first.

Step 2 — Run the merge command

Point the tool at that folder and name your output file:

python merge_excel.py ./reports -o combined.xlsx

The tool prints each file it reads with its row and column count, then saves one merged workbook called combined.xlsx.

Step 3 — Remove duplicates (optional)

If the same rows appear in more than one file, add the --dedupe flag to drop them:

python merge_excel.py ./reports -o combined.xlsx --dedupe

Step 4 — Include sub-folders or output CSV (optional)

Use --recursive to also pull files from sub-folders, and end the output name in .csv if you'd rather have a CSV:

python merge_excel.py ./data -o everything.csv --recursive
Tip: The tool automatically skips Excel lock/temp files (the hidden ~$report.xlsx files Excel creates while a workbook is open), so you won't get errors from files you didn't mean to include.

Merging Excel files with different columns

This is where manual copy-paste fails and the tool shines. Say January has the columns id, customer, amount and February adds a region column. Excel/CSV Merger keeps the union of all columns: the final file has id, customer, amount, region, and the January rows simply show a blank region instead of throwing an error or shifting data into the wrong column.

Here's what that looks like with real data:

source_fileidcustomeramountregion
january.csv1001Acme Corp250(blank)
february.xlsx1004Gamma Inc410West
february.xlsx1005Beta LLC90East

Real work use cases

People use a folder merger like this for everyday tasks such as:

  • Monthly and quarterly reporting — combine 12 monthly sales exports into one annual file for a pivot table.
  • Consolidating team submissions — merge spreadsheets from different colleagues or branches, keeping the source_file tag to track who sent what.
  • Cleaning up data exports — many systems export data in batches; this stitches them back into one dataset.
  • Survey and form responses — combine response files that were downloaded separately.
  • Preparing data for analysis — get one tidy file before loading it into Excel, Power BI, or a Python notebook.

Merger tool vs. manual copy-paste vs. Power Query

There's more than one way to combine spreadsheets. Here's an honest comparison so you can pick the right one for the job.

MethodBest forHandles different columns?Repeatable?Cost
Excel/CSV Merger Folders of many files, mixed CSV/Excel, automation Yes — keeps the union of columns Yes — one repeatable command Free (open-source)
Manual copy-paste 2–3 files with identical columns No — error-prone No Free
Excel Power Query Users who live inside Excel and want a refreshable query Yes, with setup Yes, inside that workbook Included with Excel

Power Query is a great built-in option if you want to stay inside Excel. A standalone tool wins when you're combining large folders, mixing CSV and Excel, don't have Excel installed, or want to run the same job on a schedule.

Common mistakes to avoid

  • Merging files with inconsistent headers. "Amount", "amount" and "Amt" are treated as three different columns. Standardize header names before merging for the cleanest result.
  • Forgetting the source column. Once rows are combined, you can't always tell where a record came from — keep the source_file tag on (it's on by default) unless you have a reason to drop it.
  • Assuming duplicates are gone. Deduplication only removes fully identical rows and only when you pass --dedupe. Near-duplicates (same order, different formatting) still need review.
  • Mixing the wrong sheets. For multi-sheet Excel files, the tool reads the first sheet by default. Use --sheet "SheetName" to target the right tab.
  • Leaving a workbook open. While it skips lock files, it's still safest to close Excel before merging so every file is fully saved.
📚 Want to sharpen your Excel skills? Browse the free Excel tutorials on ExcelGuru.io — practical, beginner-friendly guides on formulas, automation, VBA and more.

Frequently asked questions

How do I merge multiple CSV files into one?

Put all the CSV files in one folder and run python merge_excel.py ./yourfolder -o combined.csv. The tool reads every CSV in the folder and writes a single combined file, aligning any columns that differ between files.

Can I merge Excel files that have different columns?

Yes. Excel/CSV Merger keeps the union of all column names, so files with different or extra columns merge cleanly. Rows from files that lack a column simply show a blank value for it, instead of causing an error.

Is Excel/CSV Merger free?

Yes. It's open-source under the MIT license, which means it's free to use for personal and commercial work. You can view or download the full source code on GitHub.

Do I need Excel installed to use it?

No. The tool reads and writes Excel files using the Python library openpyxl, so it works even on machines without Microsoft Excel installed.

Can it combine CSV and Excel files together?

Yes. It handles .csv, .xlsx and .xls files in the same folder and merges them all into one output file.

How do I remove duplicate rows while merging?

Add the --dedupe flag: python merge_excel.py ./folder -o combined.xlsx --dedupe. This removes rows that are fully identical after merging.

Will it merge files in sub-folders too?

Yes, if you add the --recursive flag. Without it, the tool only reads files in the top-level folder you point it at.

Summary

Combining a folder of spreadsheets by hand is slow and breaks whenever columns don't match. Excel/CSV Merger merges multiple Excel and CSV files into one clean file with a single command — aligning columns automatically, tagging each row's source, and optionally removing duplicates. It's free, open-source, and works without Excel installed.

Download Excel/CSV Merger free on GitHub