How to merge two excel

Accessing data from multiple Excel files can be time-consuming and hard.

You often have to switch between multiple open windows, it’s messy and you feel like there’s data all over the place.

So, when you have to access data that is spread out over multiple Excel files, it makes sense to merge the sheets from all these files into one single Excel workbook.

This keeps your data organized and saves a lot of referencing time.

In this tutorial, we show you three ways to merge two Excel files:

  • Using the Move or Copy feature
  • Using VBA
  • Using Get & Transform tools

Imagine you have two separate files:

  • File1
  • File2

These two files contain order-related information (for an imaginary company).

File1 has 2 tabs (named Apr-Jun 2021 and Jul-Sep 2021) and File2 has a single tab (named Jan-Mar 2021).

File 1 with 2 sheets
File 2 with 1 sheet

Let’s say you want to merge File1 and File2 by bringing both sheets of File1 into File2.

As mentioned before, there are 3 ways to do this. The method you choose will depend on your requirement and how your data is structured.

Let us look at each method one by one.

Using the Move or Copy Feature to Merge Two Excel Files

This is the simplest and the most commonly used method to merge two Excel Files.

This method is suited in situations where you have to merge two or more Excel files that have only a few sheets, and you need to do it only once in a while.

Below are the merge two Excel files manually:

  1. Select all the tabs that you want to move or copy from File1. Since we want to move all the sheets from File1, we simply select the first tab, hold down the shift key and select the last tab.
  2. Right-click on your selected tabs and click on ‘Move or Copy’ from the context menu that appears.
Click on Move or Copy
  1. This opens the ‘Move or Copy’ dialog box.
Move or Copy dialog box
  1. Click on the dropdown under ‘To book:’.
  2. From here, you can select the file (or workbook) to which you want to move or copy the selected sheet(s). Since we want to transfer the sheet to File2, we can select the File2.xlsx option from this list.
Select the file to which to move the sheets
  1. You should now see the different move or copy options available in the list under ‘Before Sheet:’. Select where in File2 you want the sheet moved. Since Apr-Jun 2021 comes after Jan-Feb 2021, it makes sense to place it at the end (as the last sheet of File2). So select (move to end)
Select move to end option
  1. If you want to retain a copy of the sheets in File1, then check the box next to ‘Create a copy’.
Check the Create a Copy option
  1. Click OK.

All sheets of File1 should now get copied to File2, so that it now contains 3 sheets in all.

Excel files have been merged

Note that for this method to work, you need to have both the files open (one from which you want to copy the sheets and the one where you want to copy these sheets).

Also, note that this method will create a copy of sheets in File1 and add these to File2. These sheets will still remain in File1.

As I mentioned, this method is fine if you want to do this once in a while with files that have less number of sheets. If you have more sheets, there is always a chance of human error. In such cases, you can use the VBA or the Power Query method covered next.

In case you have more than two Excel files that you want to merge, you can follow the same process, where you combine two Excel files, and then combine the third/fourth file with it.

Using VBA to Merge Two Excel Files

The second method to merge two Excel files uses the following VBA script:

'Code by Steve Scott from https://spreadsheetplanet.com
Sub MergeSheets()
Dim SourceWb As Workbook
Dim TargetWb As Workbook
Set SourceWb = Workbooks("File1")
Set TargetWb = Workbooks("File2")
Dim SourceSheet As Worksheet
For Each SourceSheet In SourceWb.Sheets
SourceSheet.Copy After:=TargetWb.Sheets(TargetWb.Sheets.Count)
Next
End Sub

The above script simply takes two files, “File1” and “File2“, cycles through each sheet of File1 and appends a copy of it to File2.

All you need to do is replace the filenames “File1” and “File2” in the above code with your required source and target files.

For this code to work, your Excel files need to be open. In case you want the code to open a closed file, copy sheets from one file to another, and then close the files again, you can do that too (you will need to modify the code to do that).

Note: This script copies the “File1” sheets and pastes them into “File2”. This means the original sheets within “File1” remain as they were.

To run the above script, follow the steps below:

  1. Make sure both files that you want to merge are open.
  2. Navigate to Developer->Visual Basic.
Click on Visual Basic
  1. When the Visual Basic window opens, click Insert->Module.
Insert a module in the VB Editor
  1. Copy and paste the above code into the newly opened window.
Copy and Paste the code in the module
  1. Edit the code according to your requirement. For example, change the filenames in lines 4 and 5, or make other changes if you need to.
  2. Run the code by clicking on the Run button, as shown below:
Run theVBA code

That’s it!

You should now find the sheets of File1 and File2 merged into File2, while retaining a copy of the original sheets in File1 too.

Excel files have been merged

Note: If you cannot find the Developer menu option, navigate to File->Options->Customize Ribbon and check the Developer option. Click OK.

Using Get & Transform Tools (Power Query) to Merge Two Excel Files

If you’re using Excel 2016 or newer versions, you can also use the Get & Transform tool to merge two or more Excel files.

The Get & Transform tool is a Power Query feature that allows you to import data from multiple sources quickly and easily.

The great thing is that you can use it to make changes to your source data as required before importing it to the new workbook.

Here are the steps that you need to follow in order to merge two Excel Files using the Get & Transform tool:

  1. Open File2
  2. From the Data tab, select New Query (from the Get & Transform group).
Click on New Query
  1. Select From File -> From Workbook from the dropdown list that appears.
Select from Workbook
  1. This opens the Import Data window, from where you can select the workbook from which you want to import the sheets. Select File1 and click Import.
Select the Excel file you want to merge
  1. This opens the Navigator window, where you can see a list of all the sheets and tables from File1.
Power Query Navigator window
  1. Since we want to import more than one sheet, check the box next to ‘Select multiple items’.
Check select multiple items
  1. Check the boxes next to the sheets you want to import. In our case, we select both.
Select all the sheets you want to merge
  1. Click on the dropdown arrow next to ‘Load’ at the bottom of the window.
  2. Select ‘Load to’.
Click on Load to
  1. From the Load To window, check the radio button next to ‘Table’ and click ‘Load’.
Load as a table in the worksheet
  1. Wait for the query to complete processing.

You should now see two new sheets in File2

New sheets are inserted

Notice that the names of the sheets are just the generic Sheet1 and Sheet2, so you’ll have to double click on each tab and change the sheet names (if you need to).

That’s it! You have now merged File1 into File2, which now contains all 3 sheets!

Also, notice that the data in the newly imported sheets are in the form of an Excel table. If you don’t want that, you could simply convert them back to ranges by navigating to Table Design->Convert to Range.

Convert to Range option in Table Design

When you are asked to confirm, simply click OK.

Click Ok

In this tutorial, we showed you 3 ways to merge two files in Excel.

The first two methods (using Move or Copy and using VBA) are more commonly used since they have been around for a while.

The last method (using Get & Transform) is the lesser-used method since it is fairly new and only available in newer Excel versions.

However, Power Query is increasingly becoming the go-to tool for businesses and other industries, so it makes sense to learn how to bring together data from multiple sources into the framework, to facilitate further processing.

Other articles you may also like:

  • How to Convert a CSV File to Excel?
  • How to Convert a Text File to Excel?
  • How to Make Excel File Read Only
  • How to Insert an Excel file into MS Word
  • How to Unmerge All Cells in Excel?
  • How to Copy Multiple Sheets to a New Workbook in Excel
  • How to Group and Ungroup Worksheets in Excel
  • How to Open Excel File [xls, xlsx] Online (for FREE)
  • Microsoft Excel vs Google Sheets – Which One Is Better for You?
  • Switch Between Excel Workbooks (Shortcut)
  • How to Combine Two Columns in Excel (with Space/Comma)

Which option would you choose: have three Excel files with one worksheet each or one Excel file with three worksheets? The former is not practical and convenient from the user’s perspective. Whereas, the latter allows you to easily navigate and manipulate your records in one place. So, let’s organize your data in an efficient way by merging Excel files into one. This tutorial will help you combine multiple Excel files into one according to your needs.

How to merge Excel files – all options introduced

Most of us love Excel for its functional diversity. This means that you can do a certain action or task in multiple ways depending on your needs. For example, you can merge Excel files in the following ways:

  • Manually copy data from multiple workbooks, then paste it into one worksheet.
  • Manually copy worksheets from multiple files to a single workbook.
  • Link or export data from multiple worksheets in a single workbook.
  • Merge multiple Excel files using Power Query.
  • Merge Excel files into a single workbook using VBA macros.

If you already know which case is yours, jump right into the required section. However, we advise you read the entire guide to learn the details of merging Excel files.

How to merge two Excel files the easy way

Here we have two Excel files with one worksheet each. 

1.1 two excel files

The simplest way to merge two Excel files is to copy a data range from one of them and paste it into another one:

  • On one of the files, select a data range, then right-click and select Copy.

1.2 copy dataset excel

  • Go to the other file, select a cell where you want to paste the data, then right-click and select Paste.

1.3 paste dataset excel

In our case, we forgot to exclude the first row with column names when we copied the data range and got the following result:

1.4 merge two excel files manually

So if you use this method to merge Excel files, make sure to select the proper data range.

Obviously, this method is plain enough. However, it won’t be suitable if your Excel files contain hundreds or thousands of rows you want to merge. Let’s proceed to other options then.

How to combine multiple Excel files into one by copying their sheets

We have three Excel files with one worksheet each. We want to combine multiple excel files into one workbook but keep these separate sheets in one Excel file. So, we just need to copy these sheets.

  • Open all the files.

2.1 open three excel files

  • Right-click on the sheet you want to copy and select Move or Copy…
2.2 move or copy excel sheet
  • Select the file where you want to copy your sheet to, and check the Create a copy checkbox.
2.3 move or copy excel sheet
  • Repeat this process for the rest of the sheets, and there you go:
2.4 sheets copied to one excel file

Now you have all the sheets from separate Excel files merged in one Excel workbook.

Merge Excel files online

If you work in Excel Online and you need to merge your files located in cloud storage such as OneDrive, you can:

  • Manually copy and paste data.
  • Link Excel sheets using Workbook links.
  • Import Excel sheets from your files to a single Excel workbook and even automate the import on a schedule.

The latter option seems to be the most actionable one, so let’s dive in.

Merge multiple Excel files into one sheet

We have three Excel files on OneDrive with one worksheet each. 

3.1 merge excel files online

Let’s merge the data from these files into one sheet in the workbook Excel-File-1. The Excel integration by Coupler.io will do the job with just a few clicks.

Coupler.io is a data integration tool that allows you to schedule imports from multiple sources, such as Excel, CSV, Airtable, and many others to Microsoft Excel, Google Sheets, or Google BigQuery.

Sign up to Coupler.io with your Microsoft account, click Add importer, then select Microsoft Excel both as a source and destination app. Check out other Excel integrations.

3.2 merge excel files online

Then proceed with the setup.

Source

  • Connect your Microsoft account.
  • Select an Excel file on OneDrive and a sheet to take data from. You can select multiple sheets from a single file, but the data extracted from them will be merged into one sheet.

3.3 merge excel files online source

Destination

  • Connect your Microsoft account.
  • Select an Excel file on OneDrive and a sheet where to load the data. 

3.4 merge excel files online destination

  • Select the Append import mode to have your imported data merged not replaced.

3.5 merge excel files online append mode

You can now click Save and Run to load the data. Here is the result:

3.6 merge excel files online merge point

However, this merged data is from only two files, while we have three. You need to set up another integration for the third file. You can make a copy of this integration to speed up the setup. Click the three dots on the top-right and select Copy.

3.7 merge excel files online copy

Then replace the source file and keep the destination settings unchanged.

3.8 merge excel files online copy importer

Note: Double-check the Sheet in the Destination settings since it may be suggested that you make a copy of it. 

Now you can click Save and Run to add the data from the third Excel file to the already merged rows from two Excel files.

How to automatically merge Excel files

Coupler.io allows you to schedule imports of data from the Excel files you want to merge. So, you can combine multiple Excel files into one automatically.

For this, you need to enable the Automatic data refresh feature and configure the desired schedule. You can do this either when setting up your importer:

12.Coupler.io schedule

Or do this at any time later in the admin panel:

3.9 automatically merge excel files online

Merge Excel files with Power Query

Excel Power Query is a built-in data transformation engine that allows you to perform basic and advanced transformations with your data. Let’s see how it can cope with merging Excel files.

How to merge 3 Excel files into one

Again, we have three Excel files with one worksheet each. Locate all the files in one folder. 

  • Open a new Excel workbook. Go to New Query=> From File => From Folder

4.1 merge excel files power query new query

  • Browse and select the folder with your Excel files.

4.2 merge excel files power query path

  • On the next step, you’ll have three options:
    • Combine and Transform Data – choose this if you want to manipulate the data before merging it.
    • Combine and Load – choose this if you want to merge Excel files right away.
    • Combine and Load To… – choose this if you want to merge Excel files into another workbook.

4.3 merge excel files power query combine and load

  • On the next step, you can optionally select the object to extract from each file. Click OK.

4.4 merge excel files power query select object

  • Eventually, your files are merged into one.

4.5 merge excel files power query results

Merge 2 Excel files based on a column

Let’s solve a more complex task of merging Excel files using Power Query. We have two Excel files with one worksheet each, and we need to merge them based on a key column. In our example, let’s merge the rows that have matches based on the first_name value, if any. Here is the flow:

  • Open a new Excel workbook. Go to New Query => From File => From Workbook.

5.1 merge excel files power query new query workbook

  • Select a file and a sheet, then click Load. The data will be loaded in the form of a table.

5.2 merge excel files power query table

  • Repeat these steps to load data from the second file. As a result, you’ll have two queries.

5.3 merge excel files power query two queries

  • Go to the Query tab, then select Merge.

5.4 merge excel files power query

  • Select tables and matching columns to merge data. Once you do this, you’ll see the number of rows that match based on the selected key column. Click OK to proceed.

5.5 merge excel files power query select tables and columns

  • Then you’ll see a preview of the merged queries in the Power Query Editor.

5.6 merge excel files power query preview

If you’re not going to make any additional manipulations, click Close & Load. Here is the result.

5.7 merge excel files power query merged queries

How to merge two Excel files and remove duplicates

To remove duplicates during the process of merging Excel files, you’ll need to repeat the flow we described in the previous section. And on the step of a preview of the merged queries in the Power Query Editor, go to Home => Remove Rows => Remove Duplicates.

5.8 remove duplicates

And that’s it 🙂

How to combine multiple Excel files into one workbook and compare them

The flow that we described in the section about merging two Excel files based on a column will let you merge and compare files. You’ll need to choose a key column to compare the data from both files, and then you’ll see whether there are any matches. 

Combine data from multiple Excel files into one pivot table

Let’s add another condition to our task – combine multiple Excel workbooks into one pivot table. The Power Query will let you do this easily. For this, you’ll need first to consolidate your files as we described above. Once you have the data consolidated in one table/sheet, click the Summarize with PivotTable button in the Design menu.

pivot table

After that, you can configure the pivot table to your needs.

pivot table 2

How to combine multiple Excel files into one worksheet using macro

Excel macros are pieces of code that can implement specific actions including merging Excel files. In our guide on Excel macros, you can learn more about using and creating macros. 

And here, we’d like to introduce a few ready-to-use VBA macros to optimize the consolidation of data from multiple Excel files.

  • Go to the Developer tab => Visual Basic

6.1 excel vba macro merge excel files

  • Go to Insert => Module
6.2 excel vba macro merge excel files insert module
  • In the open window, enter one of the following scripts and run it.

6.3 excel vba macro merge excel files run module

Excel VBA macro to combine multiple Excel files into one workbook

This macro will combine all open Excel files into one new workbook.

Sub MergeFilesNewWorkbook()
On Error GoTo eh
'declare variables to hold the objects required
 Dim wbDestination As Workbook
 Dim wbSource As Workbook
 Dim wsDestination As Worksheet
 Dim wb As Workbook
 Dim sh As Worksheet
 Dim strSheetName As String
 Dim strDestName As String
 Dim iRws As Integer
 Dim iCols As Integer
 Dim totRws As Integer
 Dim strEndRng As String
 Dim rngSource As Range
'turn off the screen updating to speed things up
 Application.ScreenUpdating = False
'first create new destination workbook
 Set wbDestination = Workbooks.Add
'get the name of the new workbook so you exclude it from the loop below
 strDestName = wbDestination.Name
'now loop through each of the workbooks open to get the data
 For Each wb In Application.Workbooks
 If wb.Name <> strDestName And wb.Name <> "PERSONAL.XLSB" Then
 Set wbSource = wb
 For Each sh In wbSource.Worksheets
'get the number of rows and columns in the sheet
 sh.Activate
 ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Activate
 iRws = ActiveCell.Row
 iCols = ActiveCell.Column
'set the range of the last cell in the sheet
 strEndRng = sh.Cells(iRws, iCols).Address
'set the source range to copy
 Set rngSource = sh.Range("A1:" & strEndRng)
'find the last row in the destination sheet
 wbDestination.Activate
 Set wsDestination = ActiveSheet
 wsDestination.Cells.SpecialCells(xlCellTypeLastCell).Select
 totRws = ActiveCell.Row
'check if there are enough rows to paste the data
 If totRws + rngSource.Rows.Count > wsDestination.Rows.Count Then
 MsgBox "There are not enough rows to place the data in the Consolidation worksheet."
 GoTo eh
 End If
'add a row to paste on the next row down
 If totRws <> 1 Then totRws = totRws + 1
 rngSource.Copy Destination:=wsDestination.Range("A" & totRws)
 Next sh
 End If
 Next wb

'clean up the objects to release the memory
 Set wbDestination = Nothing
 Set wbSource = Nothing
 Set wsDestination = Nothing
 Set rngSource = Nothing
 Set wb = Nothing
'turn on the screen updating when complete
 Application.ScreenUpdating = False
Exit Sub
eh:
MsgBox Err.Description
End Sub

Excel VBA macro to merge all open Excel files into an existing workbook

This macro will combine all open Excel files into one existing workbook.

Sub MergeFilesExistingWorkbook()
 On Error GoTo eh
'declare variables to hold the objects required
 Dim wbDestination As Workbook
 Dim wbSource As Workbook
 Dim wsDestination As Worksheet
 Dim wb As Workbook
 Dim sh As Worksheet
 Dim strSheetName As String
 Dim strDestName As String
 Dim iRws As Integer
 Dim iCols As Integer
 Dim totRws As Integer
 Dim rngEnd As String
 Dim rngSource As Range
'set the active workbook object for the destination book
 Set wbDestination = ActiveWorkbook
'get the name of the active file
 strDestName = wbDestination.Name
'turn off the screen updating to speed things up
 Application.ScreenUpdating = False
'first create new destination worksheet in your Active workbook
 Application.DisplayAlerts = False
'resume next error in case sheet doesn't exist
 On Error Resume Next
 ActiveWorkbook.Sheets("Consolidation").Delete
'reset error trap to go to the error trap at the end
 On Error GoTo eh
 Application.DisplayAlerts = True
'add a new sheet to the workbook
 With ActiveWorkbook
 Set wsDestination = .Sheets.Add(After:=.Sheets(.Sheets.Count))
 wsDestination.Name = "Consolidation"
 End With
'now loop through each of the workbooks open to get the data
 For Each wb In Application.Workbooks
 If wb.Name <> strDestName And wb.Name <> "PERSONAL.XLSB" Then
 Set wbSource = wb
 For Each sh In wbSource.Worksheets
'get the number of rows in the sheet
 sh.Activate
 ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Activate
 iRws = ActiveCell.Row
 iCols = ActiveCell.Column
 rngEnd = sh.Cells(iRws, iCols).Address
 Set rngSource = sh.Range("A1:" & rngEnd)
'find the last row in the destination sheet
 wbDestination.Activate
 Set wsDestination = ActiveSheet
 wsDestination.Cells.SpecialCells(xlCellTypeLastCell).Select
 totRws = ActiveCell.Row
'check if there are enough rows to paste the data
 If totRws + rngSource.Rows.Count > wsDestination.Rows.Count Then
 MsgBox "There are not enough rows to place the data in the Consolidation worksheet."
 GoTo eh
 End If
'add a row to paste on the next row down if you are not in row 1
 If totRws <> 1 Then totRws = totRws + 1
 rngSource.Copy Destination:=wsDestination.Range("A" & totRws)
 Next sh
 End If
 Next wb
 
'clean up the objects to release the memory
 Set wbDestination = Nothing
 Set wbSource = Nothing
 Set wsDestination = Nothing
 Set rngSource = Nothing
 Set wb = Nothing
'turn on the screen updating when complete
 Application.ScreenUpdating = False
Exit Sub
eh:
MsgBox Err.Description
End Sub

Excel VBA macro to combine multiple Excel files into one workbook as separate sheets

This macro will combine all open Excel files into one new workbook and keep them as separate sheets.

Sub MergeFilesSeparateSheets()
On Error GoTo eh
    'declare variables to hold the objects required
Dim wbDestination As Workbook
Dim wbSource As Workbook
Dim wsSource As Worksheet
Dim wb As Workbook
Dim sh As Worksheet
Dim strSheetName As String
Dim strDestName As String
    'turn off the screen updating to speed things up
Application.ScreenUpdating = False 'first create new destination workbook
Set wbDestination = Workbooks.Add 'get the name of the new workbook so you exclude it from the loop below
strDestName = wbDestination.Name 'now loop through each of the workbooks open to get the data but exclude your new book or the Personal macro workbook
For Each wb In Application.Workbooks
If wb.Name <> strDestName And wb.Name <> "PERSONAL.XLSB" Then
Set wbSource = wb
For Each sh In wbSource.Worksheets
sh.Copy After:=Workbooks(strDestName).Sheets(1)
Next sh
End If
Next wb

Application.DisplayAlerts = True 'clean up the objects to release the memory
Set wbDestination = Nothing
Set wbSource = Nothing
Set wsSource = Nothing
Set wb = Nothing 'turn on the screen updating when complete
Application.ScreenUpdating = False
Exit Sub
eh:
    MsgBox Err.Description
End Sub

Wrap-up: Merge CSV files in Excel

As a wrap-up, we decided to touch on how to merge CSV files in Excel. Actually, there is nothing complex since most of the methods above allow you to do this. Once you open a CSV file in Excel, it will look like a regular workbook, so you can use Power Query or VBA macros to merge them.

If your CSV files are stored online, you can easily merge them using Coupler.io in the same way we did with Excel files. The only difference is that you won’t need to select a sheet. Choose the best option for your needs and optimize your workflow as much as possible. Good luck with your data!

  • Zakhar Yung

    A content manager at Coupler.io whose key responsibility is to ensure that the readers love our content on the blog. With 5 years of experience as a wordsmith in SaaS, I know how to make texts resonate with readers’ queries✍🏼

Back to Blog

Focus on your business

goals while we take care of your data!

Try Coupler.io

If you’re a Microsoft Excel user, it doesn’t take long before you have many different workbooks full of important spreadsheets. What happens when you need to combine these multiple workbooks together so that all of the sheets are in the same place?

Excel can be challenging at times because it’s so powerful. You know that what you want to do is possible, but you might not know how to accomplish it. In this tutorial, I’ll show you several techniques you can use to merge Excel spreadsheets.

When you need to combine multiple spreadsheets, don’t copy and paste the data from each sheet manually. There are many shortcuts that you can use to save time in combining workbooks, and I’ll show you which one is right for each situation.

Combine Excel SpreadsheetsCombine Excel SpreadsheetsCombine Excel Spreadsheets

Watch & Learn

The screencast below will show you how to combine Excel sheets into a single consolidated workbook. I’ll teach you to use PowerQuery (also called Get & Transform Data) to pull together data from multiple workbooks.

Important: The email addresses used in this tutorial are fictitious (randomly generated) and not intended to represent any real email addresses.

Read on to see written instructions. As always, Excel has multiple ways to accomplish this task, and how you’re working with your data will drive which approach is the best.

1. How to Move & Copy Sheets (Simplest Method)

The easiest method to merge Excel spreadsheets is to simply take the entire sheet and copy it from one workbook to another.

To do this, start off by opening both Excel workbooks. Then, switch to the workbook that you want to copy several sheets from.

Now, hold Control (or Command on Mac) on your keyboard and click on all of the sheets that you want to copy to a separate workbook. You’ll notice that as you do this, the tabs will show as highlighted.

Now, simply right click and choose Move or Copy from the menu.

Move or Copy from MenuMove or Copy from MenuMove or Copy from Menu

Control+click (or command+click) on all of the sheets that you want to move or copy between workbooks, then right click and choose Move or Copy.

On the Move or Copy pop up window, the first thing that you’ll want to do is select the workbook that you want to move the sheets to. Choose the name of the file from the «To book» drop-down.

Move or Copy Popup OptionMove or Copy Popup OptionMove or Copy Popup Option

On the pop-up window, choose the workbook that you want to copy or move your sheets into, and ensure that you check Create a copy if you don’t want to move all of the sheets.

Also, you can choose where the sheets are placed in the new workbook in terms of sequence. The Before sheet menu controls where sequentially in the workbook the sheets will be inserted. You can always choose (move to end) and re-sequence the order the sheets later as needed.

Finally, it’s optional check the box to Create a copy, which will duplicate the sheets and create a separate copy of them in the workbook you’re moving the sheets to. Once you press OK, you’ll see that the sheets we copied are in the combined workbook.

Sheets in Excel workbookSheets in Excel workbookSheets in Excel workbook

Now, the two sheets we selected from a separate workbook are copied into the main workbook.

This approach has a few downsides. If you keep working with two separate files, they aren’t «in sync.» If you make changes to the original workbook that you copied the sheets from, they won’t automatically update in the combined workbook.

2. Prepare to Use Get & Transform Data Tools to Combine Sheets

Excel has an incredibly powerful set of tools that are often called PowerQuery. Beginning with Excel 2016, this feature set was rebranded as Get & Transform Data. 

As the name suggests, these are a set of tools that helps you pull data together from other workbooks and consolidate it into one workbook.

Data Get and Transform Excel ribbonData Get and Transform Excel ribbonData Get and Transform Excel ribbon

In Excel 2016 for Windows or the Office365 version of Excel, you’ll find this feature on the Data tab in the Get & Transform options.

Also, this feature is exclusive to Excel for Windows. You won’t find it in the Mac versions or in the web browser edition of Microsoft’s app.

Before You Start: Check the Data

The most important part of this process is checking your data before you start combining it. The files need to have the same setup for the data structure, with the same columns. You can’t easily combine a four-column spreadsheet and a five-column spreadsheet, as Excel won’t know where to place the data.

Compare data setsCompare data setsCompare data sets

Before you try to combine data with Get & Transform Data feature, it really helps to ensure that the data is in the same structure, with the same columns in each workbook you’re combining.

Often, you’ll find yourself needing to combine spreadsheets when you’re downloading data from systems. In that case, it’s much easier to make sure the system you’re downloading data is configured to download data in the same columns each time.

Before I download data from a service like Google Analytics, I always make sure that I’m downloading the same report format each time. This ensures that I can easily work with and combine multiple spreadsheets together.

Whether you’re pulling data from a system like Google Analytics, MailChimp, or an ERP like SAP or Oracle that powers huge companies, the best way to save time is to ensure that you’re downloading data in a common format.

Now that we’ve checked our data, it’s time to dive into learning how to combine Excel sheets. 

3. How to Combine Excel Sheets in a Folder Full of Files

A few times, I’ve had a folder full of files that I needed to put together into a single, consolidated file. When you’ve got dozens or even hundreds of files, opening them one-by-one to combine them just isn’t feasible. Learning this technique can save you dozens of hours on a single project.

Again, it’s crucial that the data is in the same format. To get started, it helps to place all of the files in the same folder so that Excel can easily watch this folder for changes. 

Combining Folder of filesCombining Folder of filesCombining Folder of files

Make sure that you’ve placed all of your Excel files in the same folder, then choose New Query > From File > From Folder on Excel’s ribbon.

Step 1. Point Excel to the Folder of Files

On the pop-up window, you’ll want to specify a path to the folder that holds your Excel workbooks.

Folder Path Microsoft ExcelFolder Path Microsoft ExcelFolder Path Microsoft Excel

Set the folder path to the folder with the files you want to combine.

You can browse to that path, or simply paste in the path to the folder with your workbooks.

Step 2. Confirm the List of Files

After you show Excel where the workbooks are stored, a new window will pop up that shows the list of files you’re set to combine. Right now, you’re only seeing metadata about the files, and not the data inside of it.

List of files to combineList of files to combineList of files to combine

This window simply shows the files that are going to be combined with our query, 

This window simply shows the files that are going to be combined with our query. You’ll see the file name, the type, and the dates accessed and modified. If you’re missing a file in this list, confirm that all of the files are in the folder and retry the process.

To move on to the next step, click on Edit. 

Step 3. Confirm the Combination

The next menu helps to confirm the data inside your files. Since we’ve already checked that data is the same structure in our multiple files, we can simply click OK on this step.

Confirm Combining Files ExcelConfirm Combining Files ExcelConfirm Combining Files Excel

This is a check-step to ensure that our files are in the same structure, so simply press OK to move to the next step.

Step 4. How to Combine Excel Sheets With a Click

Now, a new window pops up with the list of files we’re set to combine.

At this stage, you’re still seeing metadata about the files and now the data itself. To solve that, click on the double drop-down arrow in the upper right corner of the first column.

Click to Combine FilesClick to Combine FilesClick to Combine Files

Click on the double drop-down arrow in the first column to load the source data from each file.

Voila! Now, you’ll see the actual data from inside the files combined into one place. 

Query Editor Data CombinedQuery Editor Data CombinedQuery Editor Data Combined

Once you combine your data, you’ll see all of it combined into one file, and the original filename shows in the first column.

Scroll through the data to confirm that all of your rows are there. Notice that the only change from your original data is that the filename of each source file is in the first column.

Step 5. Close and Load the Data

Believe it or not, we’re basically finished with combining our Excel spreadsheets. The data is in the Query Editor for now, so we’ll need to «send it back» to regular Excel so that we can work with it.

Click on Close & Load in the upper right corner. You’ll see the finished data in a regular Excel spreadsheet, ready to review and work with.

Combined Data Set in ExcelCombined Data Set in ExcelCombined Data Set in Excel

Once you click Close & Load, you’ll see all of the data from the original files combined into one sheet.

Imagine using this feature to roll up multiple files from different members of your team. Choose a folder that you’ll each store files in, and then combine them into one cohesive file with this feature in just a few minutes.

Recap & Keep Learning

In this tutorial, you learned several techniques for how to combine Excel sheets. When you’ve got many sheets that you need to stitch together, using one of these approaches will save you time so that you can get back to the task at hand!

Check out some of the other tutorials to level up your Excel skills. Each of these tutorials will teach you a method for accomplishing tasks in less time in Microsoft Excel.

How do you merge Excel workbooks? Let me know in the comments section below whether you’ve got a preference for these methods, or a technique of your own that you use.

Did you find this post useful?

Andrew Childress

I believe that life is too short to do just one thing. In college, I studied Accounting and Finance but continue to scratch my creative itch with my work for Envato Tuts+ and other clients. By day, I enjoy my career in corporate finance, using data and analysis to make decisions.

I cover a variety of topics for Tuts+, including photo editing software like Adobe Lightroom, PowerPoint, Keynote, and more. What I enjoy most is teaching people to use software to solve everyday problems, excel in their career, and complete work efficiently. Feel free to reach out to me on my website.

You have several Excel workbooks and you want to merge them into one file? This could be a troublesome and long process. But there are 6 different methods of how to merge existing workbooks and worksheets into one file. Depending on the size and number of workbooks, at least one of these methods should be helpful for you. Let’s take a look at them.

Summary

If you want to merge just a small amount of files, go with methods 1 or method 2 below. For anything else, please take a look at the methods 4 to 6: Either use a VBA macro, conveniently use an Excel-add-in or use PowerQuery (PowerQuery only possible if the sheets to merge have exactly the same structure).

Method 1: Copy the cell ranges

copy, paste, source, main, merge, join
Copy and paste the source content into your main workbook.

The obvious method: Select the source cell range, copy and paste them into your main workbook. The disadvantage: This method is very troublesome if you have to deal with several worksheets or cell ranges. On the other hand: For just a few ranges it’s probably the fastest way.

Method 2: Manually copy worksheets

copy, move, worksheet, sheet, excel
Copy worksheets separately to the “master” workbook.

The next method is to copy or move one or several Excel sheets manually to another file. Therefore, open both Excel workbooks: The file containing the worksheets which you want to merge (the source workbook) and the new one, which should comprise all the worksheets from the separate files.

  1. Select the worksheets in your source workbooks which you want to copy. If there are several sheets within one file, hold the Ctrl key computer_key_Ctrland click on each sheet tab. Alternatively, go to the first worksheet you want to copy, hold the Shift key computer_key_Shift and click on the last worksheet. That way, all worksheets in between will be selected as well.
  2. Once all worksheets are selected, right click on any of the selected worksheets.
  3. Click on “Move or Copy”.
  4. Select the target workbook.
  5. Set the tick at “Create a copy”. That way, the original worksheets remain in the original workbook and a copy will be created.
  6. Confirm with OK.

One small tip at this point: You can just drag and drop worksheets from one to another Excel file. Even better: If you press and hold the Ctrl-Key when you drag and drop the worksheets, you create copies.


Do you want to boost your productivity in Excel?

Get the Professor Excel ribbon!

Add more than 120 great features to Excel!


Method 3: Use the INDIRECT formula

The next method comes with some disadvantages and is a little bit more complicated. It works, if your files are in a systematic file order and just want to import some certain values. You build your file and cell reference with the INDIRECT formula. That way, the original files remain and the INDIRECT formula only looks up the values within these files. If you delete the files, you’ll receive #REF! errors.

indirect, link, other, file, excel
With the INDIRECT formula you can link to other files. Only condition: the source file must be open in the background.

Let’s take a closer look at how to build the formula. The INDIRECT formula has only one argument: The link to another cell which can also be located within another workbook.

  1. Copy the first source cell.
  2. Paste it into your main file using paste special (Ctrl computer_key_Ctrl+ Alt computer_key_Alt+ v computer_key_V). Instead of pasting it normally, click on “Link” in the bottom left corner of the Paste Special window. That way, you extract the complete path. In our case, we have the following link:
    =[160615_Examples.xlsm]Thousands!$C$4
  3. Now we wrap the INDIRECT formula around this path. Furthermore, we separate it into file name, sheet name and cell reference. That way, we can later on just change one of these references, for instance for different versions of the same file. The complete formula looks like this (please also see the image above):
    =INDIRECT(“‘”&$A3&$B3&”‘!”&D$2&$C3)

Important – please note: This function only works if the source workbooks are open.

Method 4: Merge files with a simple VBA macro

You are not afraid of using a simple VBA macro? Then let’s insert a new VBA module:

  1. Go to the Developer ribbon. If you can’t see the Developer ribbon, right click on any ribbon and then click on “Customize the Ribbon…”. On the right hand side, set the tick at “Developer”.
  2. Click on Visual Basic on the left side of the Developer ribbon.
  3. Right click on your workbook name and click on Insert –> Module.
  4. Copy and paste the following code into the new VBA module. Position the cursor within the code and click start (the green triangle) on the top. That’s it!
Sub mergeFiles()
    'Merges all files in a folder to a main file.
    
    'Define variables:
    Dim numberOfFilesChosen, i As Integer
    Dim tempFileDialog As fileDialog
    Dim mainWorkbook, sourceWorkbook As Workbook
    Dim tempWorkSheet As Worksheet
    
    Set mainWorkbook = Application.ActiveWorkbook
    Set tempFileDialog = Application.fileDialog(msoFileDialogFilePicker)
    
    'Allow the user to select multiple workbooks
    tempFileDialog.AllowMultiSelect = True
    
    numberOfFilesChosen = tempFileDialog.Show
    
    'Loop through all selected workbooks
    For i = 1 To tempFileDialog.SelectedItems.Count
        
        'Open each workbook
        Workbooks.Open tempFileDialog.SelectedItems(i)
        
        Set sourceWorkbook = ActiveWorkbook
        
        'Copy each worksheet to the end of the main workbook
        For Each tempWorkSheet In sourceWorkbook.Worksheets
            tempWorkSheet.Copy after:=mainWorkbook.Sheets(mainWorkbook.Worksheets.Count)
        Next tempWorkSheet
        
        'Close the source workbook
        sourceWorkbook.Close
    Next i
    
End Sub

Method 5: Automatically merge workbooks

The fifth way is probably most convenient:

Click on “Merge Files” on the Professor Excel ribbon.

Now select all the files and worksheets you want to merge and start with “OK”.

This procedure works well also for many files at the same time and is self-explanatory. Even better: Besides XLSX files, you can also combine XLS, XLSB, XLSM, CSV, TXT and ODS files.

To do that you need a third party add-in, for example our popular “Professor Excel Tools” (click here to start the download).

Here is the whole process in detail:

Just click on "Merge Files" on the Professor Excel ribbon, select your files and click on OK.

Just click on “Merge Files” on the Professor Excel ribbon, select your files and click on OK.

Method 6: Use the Get & Transform tools (PowerQuery)

merge, workbooks, get, transform, complete, folder
merge, workbooks, get, transform, complete, folder
merge, workbooks, get, transform, complete, folder

The current version of Excel 365 offers the “Get & Transform” tools to import data. These functions are very powerful and are supposed to replace the old “Text Import Wizard”. However, they have one useful feature: Import a complete folder of documents.

The requirements: The workbooks and worksheets you want to import have to be in the same format.

Please follow these steps for importing a complete folder of Excel files.

  1. Create a folder with all the documents you want to import.
  2. Usually it’s the fastest to just copy the folder path directly from the Windows Explorer. You still have the change to later-on select the folder, though.
  3. Within Excel, go to the Data ribbon and click on “Get Data”, “From File” and then on “From Folder”.
  4. Paste the previously copied path or select it via the “Browse” function. Continue with “OK”.
  5. If all files are shown in the following window, either click on “Combine” (and then on “Combine & Load To”) or on “Edit”. If you click on “Edit”, you can still filter the list and only import a selection of the files in the list. Recommendation: Put only the necessary files into your import folder from the beginning so that you don’t have to navigate through the complex “Edit” process.
  6. Next, Excel shows an example of the data based on the first file. If everything seems fine, click on OK. If your files have several sheets, just select the one you want to import, in this example “Sheet1”. Click on “OK”.
  7. That’s it, Excel now imports the data and inserts a new column containing the file name.

For more information about the Get & Transform tools please refer to this article.

Next step: Merge multiple worksheets to one combined sheet

After you have combined many Excel workbooks into one file, usually the next step is this: Merge all the imported sheets into one worksheet.

Because this is a whole different topic by itself, please refer to this article.

Image by MartinHolzer from Pixabay

How to Merge Excel Sheets

  1. Open the sheets you want to merge.
  2. Click Home > Format > Move or Copy Sheet.
  3. Use the dropdown menu to select (new book).
  4. Click OK.

Contents

  • 1 Can I merge two Excel worksheets together?
  • 2 How do I merge Excel files into one?
  • 3 How do you merge two Excel sheets and remove duplicates?
  • 4 How do I create a master sheet from multiple sheets in Excel?
  • 5 How do I link two Excel sheets using Vlookup?
  • 6 How do I link an entire worksheet in Excel?
  • 7 How do I reference another sheet in Excel?
  • 8 How do I merge two Excel sheets without losing data?
  • 9 How do you merge data in Excel without duplicates?
  • 10 How do I merge duplicates in Excel without losing data?
  • 11 How do I make a list from the same cell across multiple sheets in Excel?
  • 12 How do I merge multiple worksheets into one sheet in Excel VBA?
  • 13 How do I merge two names in Excel?
  • 14 What is an Xlookup in Excel?
  • 15 How do I link an entire worksheet to another sheet?
  • 16 How do you link spreadsheets?
  • 17 How do you concatenate?
  • 18 How does concatenate in Excel Work?

Can I merge two Excel worksheets together?

Combine by position
Open each source sheet and make sure that your data is in the same position on each sheet.On the Data tab, in the Data Tools group, click Consolidate. In the Function box, click the function that you want Excel to use to consolidate the data.

How do I merge Excel files into one?

Open the original Shared Workbook into which you want to merge changes. Click the Tools menu and then select Merge Workbooks…. If prompted, save the workbook. In the file navigation dialog box, click the copy of the workbook that contains the changes you want to merge, then click OK.

How do you merge two Excel sheets and remove duplicates?

Remove Duplicates

  1. Open a workbook with two worksheets you’d like to merge.
  2. Select all data in the first worksheet, and then press “Ctrl-C” to copy it to the clipboard.
  3. Select all data in the new workbook, and then click the Data tab’s “Remove Duplicates” command, located in the Data Tools command group.

How do I create a master sheet from multiple sheets in Excel?

How to collect data from multiple sheets to a master sheet in…

  1. In a new sheet of the workbook which you want to collect data from sheets, click Data > Consolidate.
  2. In the Consolidate dialog, do as these: (1 Select one operation you want to do after combine the data in Function drop down list;
  3. Click OK.

How do I link two Excel sheets using Vlookup?

Vlookup between sheets and return multiple columns

  1. In the first row, select all the cells to be populated (B2:C2 in our example).
  2. Type the formula and press Ctrl + Shift + Enter.
  3. Drag down the formula to the remaining rows.

How do I link an entire worksheet in Excel?

Linking Workbooks
Click in the cell where you want the result to be, press the equal sign (=) on the keyboard and then use your mouse to select the workbook, click on the worksheet, click on the cell you want to link to and press Enter to accept. The formula bar will show the full path of the linked cell.

How do I reference another sheet in Excel?

To reference a cell or range of cells in another worksheet in the same workbook, put the worksheet name followed by an exclamation mark (!) before the cell address. For example, to refer to cell A1 in Sheet2, you type Sheet2!A1. For example, to refer to cells A1:A10 in Sheet2, you type Sheet2!A1:A10.

How do I merge two Excel sheets without losing data?

Combine multiple worksheets into one with Copy Sheets

  1. Start the Copy Sheets Wizard. On the Excel ribbon, go to the Ablebits tab, Merge group, click Copy Sheets, and choose one of the following options:
  2. Select worksheets and, optionally, ranges to merge.
  3. Choose how to merge sheets.

How do you merge data in Excel without duplicates?

Merge Lists Without Duplicates

  1. Select and right-click a second range that will be merged (C2:C6) and click Copy (or use the keyboard shortcut CTRL + C).
  2. Right-click on the first empty cell after the first list (e.g., B10) and click Paste (or use the keyboard shortcut CTRL + V).

How do I merge duplicates in Excel without losing data?

How to combine duplicate rows into one (keeping unique values only)

  1. Select the duplicate rows you want to merge and run the Merge Duplicates wizard by clicking its button on the ribbon.
  2. Make sure your table is selected correctly and click Next.
  3. Select the key column to check for duplicates.
  4. Choose the columns to merge.

How do I make a list from the same cell across multiple sheets in Excel?

Click the tab for the first worksheet that you want to reference. Hold down the Shift key then click the tab for the last worksheet that you want to reference. Select the cell or range of cells that you want to reference. Complete the formula, and then press Enter.

How do I merge multiple worksheets into one sheet in Excel VBA?

Merging all sheets of active workbook into one sheet with VBA

  1. Activate the workbook you want to combine its all sheets, then press Alt + F11 keys to open Microsoft Visual Basic for Applications window.
  2. In popping window, click Insert > Module to create a new Module script.
  3. Copy below code and paste them to the script.

How do I merge two names in Excel?

On the Ablebits Data tab in the Merge group, click the Merge Duplicates icon:

  1. Step 1: Select your table. On the first step, the add-in picks the entire range with your data:
  2. Step 2: Choose key columns with duplicate records.
  3. Step 3: Pick columns with the values to merge.

What is an Xlookup in Excel?

Use the XLOOKUP function to find things in a table or range by row.With XLOOKUP, you can look in one column for a search term, and return a result from the same row in another column, regardless of which side the return column is on.

How do I link an entire worksheet to another sheet?

Thanks. Open both workbooks, and in cell A1 of a blank sheet in your workbook, type an equals sign, and then navigate to the other workbook/worksheet with the data and select cell A1. Press F4 until the $ signs go away, and then press enter.

How do you link spreadsheets?

Link to data

  1. In Sheets, click the cell you want to add the link to.
  2. Click Insert. Link.
  3. In the Link box, click Select a range of cells to link.
  4. Highlight the cell or range of cells you want to link to. Move the Select a data range window if it’s in the way.
  5. Click OK.
  6. (Optional) Change the link text.
  7. Click Apply.

How do you concatenate?

There are two ways to do this:

  1. Add double quotation marks with a space between them ” “. For example: =CONCATENATE(“Hello”, ” “, “World!”).
  2. Add a space after the Text argument. For example: =CONCATENATE(“Hello “, “World!”). The string “Hello ” has an extra space added.

How does concatenate in Excel Work?

How it works. The word concatenate is just another way of saying “to combine” or “to join together”. The CONCATENATE function allows you to combine text from different cells into one cell. In our example, we can use it to combine the text in column A and column B to create a combined name in a new column.

Понравилась статья? Поделить с друзьями:
  • How to merge excel files in one file
  • How to merge data in excel
  • How to merge cells with excel
  • How to measure word
  • How to mark the text in word