The tutorial shows three ways to combine Excel files into one: by copying sheet tabs, running VBA, and using the Copy Worksheets tool.
It is a lot easier to process data in a single file instead of switching between numerous sources. However, merging multiple Excel workbooks into one file could be a cumbersome and long process, especially if the workbooks you need to combine contain multiple worksheets. So, how would you approach the problem? Will you be coping sheets manually or with VBA code? Or, do you use one of the specialized tools to merge Excel files? Below you will find a few good ways to handle this task.
Note. In this article, we are going to look at how to copy sheets from multiple Excel workbooks into one workbook. If you are looking for a quick way to copy data from several worksheets into one sheet, you will find the detailed guidance in another tutorial: How to merge multiple sheets into one.
How to merge two Excel files into one by copying sheets
If you have just a couple of Excel files to merge, you can copy or move sheets from one file to another manually. Hers's how:
- Open the workbooks you wish to combine.
- Select the worksheets in the source workbook that you want to copy to the main workbook.
To select multiple sheets, use one of the following techniques:
- To select adjacent sheets, click on the first sheet tab that you want to copy, press and hold the Shift key, and then click on the last sheet tab. This will select all worksheets in between.
- To select non-adjacent sheets, hold the Ctrl key and click on each sheet tab individually.
- With all worksheets selected, right click on any of the selected tabs, and then click Move or Copy….
- In the Move or Copy dialog box, do the following:
- From the Move selected sheets to book drop-down list, select the target workbook into which you want to merge other files.
- Specify where exactly the copied sheet tabs should be inserted. In our case, we choose the move to end option.
- Select the Create a copy box if you want the original worksheets to remain in the source file.
- Click OK to finish the merge process.
The screenshot below shows the result - sheets from two Excel files combined into one. To merge tabs from other Excel files, repeat the above steps for each workbook individually.
When coping sheets manually, please be aware of the following limitation imposed by Excel: it is not possible to move or copy a group of sheets if any of those sheets contains a table. In this case, you will have to either convert a table to a range or use one of the following methods that do not have this limitation.
How to merge Excel files with VBA
If you have multiple Excel files that have to merged into one file, a faster way would be to automate the process with a VBA macro.
Below you will find the VBA code that copies all sheets from all Excel files that you select into one workbook. This MergeExcelFiles macro is written by Alex, one of our best Excel gurus.
Important note! The macro works with the following caveat - the files to be merged should not be open physically or in memory. In such a case, you will get a run-time error.
How to add this macro to your workbook
If you'd like to insert the macro in your own workbook, perform these usual steps:
- Press Alt + F11 to open the Visual Basic Editor.
- Right-click ThisWorkbook on the left pane and select Insert > Module from the context menu.
- In the window that appears (Code window), paste the above code.
For the detailed step-by-step instructions, please see How to insert and run VBA code in Excel.
Alternatively, you can download the macro in an Excel file, open it alongside your target workbook (enable macro if prompted), then switch to your own workbook and press Alt + F8 to run the macro. If you are new to using macros in Excel, please follow the detailed steps below.
How to use the MergeExcelFiles macro
Open the Excel file where you want to merge sheets from other workbooks and do the following:
- Press Alt + F8 to open the Macro dialog.
- Under Macro name, select MergeExcelFiles and click Run.
- The standard explorer window will open, you select one or more workbooks you want to combine, and click Open. To select multiple files, hold down the Ctrl key while clicking the file names.
Depending on how many files you've selected, allow the macro a few seconds or minutes to process them. After the macro completes, it will notify you how many files have been processed and how many sheets have been merged:
Combine multiple Excel files into one with Ultimate Suite
If you are not very comfortable with VBA and looking for an easier and faster way to merge Excel files, have a look at the Copy Sheets tool, one of 70+ time saving features included with our Ultimate Suite for Excel.
With the Ultimate Suite, merging multiple Excel workbooks into one is as easy as one-two-three (literally, only 3 quick steps). You don't even have to open all of the workbooks you want to combine.
- With the master workbook open, go to the Ablebits Data tab > Merge group, and click Copy Sheets > Selected Sheets to one Workbook.
- In the Copy Worksheets dialog window, select the files (and optionally worksheets) you want to merge and click Next.
Tips:
- To select all sheets in a certain workbook, just put a tick in the box next to the workbook name, all the sheets within that Excel file will be selected automatically.
- To merge sheets from closed workbooks, click the Add files… button and select as many workbooks as you want. This will add the selected files only to the Copy Worksheets window without opening them in Excel.
- To copy only a specific area in a certain workbook, hover over the sheet name with your mouse, then click the Collapse Dialog icon and select the desired range. By default, all data is copied.
- Select one or more additional options, if needed, and click Copy. The screenshot below shows the default settings: Paste all (formulas and values) and Preserve formatting.
Allow the Copy Worksheets wizard a few seconds for processing and enjoy the result!
To have a closer look at this and other merge tools for Excel, you are welcome to download an evaluation version of Ultimate Suite.
Other ways to merge Excel sheets and combine data
The above examples have demonstrated the best techniques to merge multiple Excel files into one. For more ways to combine sheets in Excel, please check out the following resources.
Available downloads
Macro to merge multiple Excel files (.xlsm file)
Ultimate Suite 14-day fully-functional version (.exe file)
249 comments
VBA can do everything you want
This is so useful
Hello,
I want to merge two spread sheets but the information in each is different. If use your merge process will this program merge the sheets and keep the differences different?
Hi,
How do I merge / append multiple excel files into one single sheet - Eg. 5 files, which needs to be merged all together in one sheet, not a one excel file per sheet but all in one?
thanks in advance
/T
Hello!
To combine multiple files into one sheet, you can use Ablebits Data - Copy Sheets - Data from selected sheets to one sheet.
It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.
thanks for the vba macro - I over a hundred separate reports to merge into on and this definitely helped save some time :D
Worked Great!!! Many Thanks!!!
This was very helpful, thank you. Could you suggest an amend that would allow data to be pulled from encrypted Workbooks as well? (provided of course that you had all the individual file names and corresponding passwords to access those files?)
4 files needs to be merged into 1 file as 4 separate tabs. To be done for 2000 files with an outcome of 500 files with 4 tabs each. We cant don it manually, is there a VBA code to pick up files and merge them ? File naming convention can be devised based on the VBA code. Please suggest.
Hello!
I can't tell you anything about VBA code. But Ultimate Suite for Excel can combine tables.
Could you please describe your task in more detail and send us a small sample workbook with the source data and expected result to support@ablebits.com? Please shorten your tables to 10-20 rows/columns and include the link to your blog comment.
We'll look into your task and try to help.
I have two excel files. One has name and variable A. The second has name and variable B. I would like to combine the two so that I can see name, variable A, and Variable B. How do I do that?
Hello!
The information presented to you is not enough to give you advice.
If Name is a column for comparing your files, then you can of course combine them.
Please describe your problem in more detail. It’ll help me understand it better and find a solution for you.
Hi. thank you very much for the super handy trick!
I have one question. may I know like is there any limit for this shortcut? for example it only works for certain number of excel sheets or certain rows or columns in each excel sheets
Hello!
Our add-in doesn't have clearly defined limitations on the number of sheets, rows and cells with the data to process. However, it may take some time for the add-in to handle thousands of rows and the processing speed also depends on such things as the formatting of your data, other processes running at the moment, available system resources, etc.
This was awesome! Saved me so much time. Lifesaver.
This is great! Could you please confirm if this is a one-time copy/paste (which move and copy does quite well, so must be more...) or if this is actually linked to the other spreadsheet? In other words, will my merged workbook now get updated automatically when the other workbook is updated or changed? Which is what we want. Fingers crossed!
Can anyone advise how to use this code and also retain the name of the excel in individual sheets? Now when I used this code, it did work out but naming convention is sheet1(x).
I want the name as per the names of the excel sheets.
Hi,
I'm using this VBA to merge multiple workbooks but holding down the control key doesn't allow me to select multiple workbooks. Neither does holding down Shift. Any ideas what's wrong?
Thanks in advance.
Brendan
I got an error.
When I click on "debug", the following line of code was highlighted in yellow:
fnameList = Application.GetOpenFilename(FileFilter:="Microsoft Excel Workbooks (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm", Title:="Choose Excel files to merge", MultiSelect:=True)
It happened both with the excel file that I downloaded and with the one I created myself.
Help?
I have Excel 16.38 and can't seem to figure out how to get the workbook tabs at the top to appear. I can see the worksheet tabs at the bottom but not the workbooks. How do I make them appear? It would seem fairly simple.
Thank you
Just wanted to say thanks for that macro, it saved me a lot of work.
Hi! I am trying to modify this VBA code to let me pull only the first tab from multiple excel workbooks into a single excel file. Does anyone know what I should modify from above to make this work? Thanks in advance!
I'm trying to merge 388 .xls into one. Each .xls has 1 tab. When I try and merge, it only brings in about 60%~ of the tabs. Thoughts?
Thanks for the assistance!
Sam
this is a great example of a "jab jab jab, right hook" @garyV