Free tool
Merge two Excel or CSV files into one
Two files to make one? Drop them both: add one under the other, or side by side matched by a column. The result downloads as one file.
jan.csv
| Name | City |
|---|---|
| Ana | Lyon |
| Bo | Oslo |
feb.csv
| Name | City |
|---|---|
| Cy | Rome |
| Name | City |
|---|---|
| Ana | Lyon |
| Bo | Oslo |
| Cy | Rome |
How to merge two Excel files in Excel
- To add rows: put both files' columns in the same order, then copy the second file's rows (without its header row) and paste them in the first empty row under the first file's data. Sheets of one workbook work the same way.
- To add columns: in the first file, type the header of the column you want from the second file in the first empty column.
- In the row below, type =XLOOKUP(A2, then select the matching column in the second file, type a comma, select the column to bring in, type ,"") and press Enter. A2 is the cell holding the value both files share.
- Double-click the fill handle to fill the formula down. A row with no match stays empty. Repeat steps 2 and 3 for each column you want.
- Copy the new columns and paste them over themselves with Paste Special, Values, so they keep their values once the second file is closed. XLOOKUP needs Excel 2021 or Microsoft 365.
Or skip the steps: drop your files in the tool above.
Questions
Is my file uploaded?
No. This page reads your file inside your browser tab, and nothing is sent to a server.
Which files does it take?
Excel workbooks (.xlsx) and CSV files, mixed as you like, up to 20 at once, 50 MB each and 100 MB in all. Drop one workbook to put its sheets under one another. You download the first file's format, as values. Have an old .xls file? Open it in Excel and save it as Excel Workbook (.xlsx).
What if my files' columns don't match?
Add rows lines columns up by their header, ignoring capitals, spaces and underscores, so First Name and first_name become one column. A column found in only some files is kept, empty in the other rows, and the page names it. A last column says which file each row came from.
How are rows matched when I add columns?
Each row of the first file looks for a row of the second file with the same value in the column you picked, ignoring capitals, spaces and punctuation. Every row of the first file is kept, in its order; a row with no match gets empty cells. If a value appears twice in the second file, its first row is used. Click Swap to keep the other file's rows instead.
Can Excel do this without formulas?
Yes, with Power Query: on the Data tab, click Get Data and load both files, then use Append Queries to add rows or Merge Queries to add columns. Merge Queries keeps only matching rows unless you set Join Kind to Left Outer.
More from DocTransform
Fix or check a file
- Change the date format in Excel or CSV
- Remove duplicates in Excel or CSV
- Split full names into first and last in Excel or CSV
- Format phone numbers in Excel or CSV
- Combine two columns in Excel or CSV
- Check your CSV before you upload it to HubSpot
- Check your bank statement CSV before you upload it to Xero
- Check your products CSV before you upload it to Shopify