Merge excel multiple files

Bookmark this app

Press Ctrl + D to add this page to your favorites or Esc to cancel the action.

Send the download link to

Send us your feedback

Oops! An error has occurred.

Invalid file, please ensure that uploading correct file

Error has been reported successfully.


You have successfully reported the error, You will get the notification email when error is fixed.

Click this link to visit the forums.

Immediately delete the uploaded & processed files.

Are you sure to delete the files?

Enter Url

If you ask people who work with data, you will get to know that combining Excel files or merging workbooks is a part of their daily work.

Agree?

A simple an example: Let’s say you want to create a sales report and you have data of four different zones in four different files.

Now:

The very first thing you need to do is to combine those files in one single workbook and only then you can create your report further.

The point is: You have to have a method which you can use for merging these files. Say “YES” in the comment section if you want to know the best method for this.

Today in this post, I’m going to share with you the best way to merge data from multiple Excel files into a SINGLE workbook.

But, here’s the kicker.

This post will teach you something you need to learn to use in the real world data problem so make sure to read the entire post.

The Best Possible Way for Combining Excel Files by Merging data into ONE Workbook — POWER QUERY

Power Query is the best way to merge or combine data from multiple Excel files in a single file. You need to store all the files in a single folder and then use that folder to load data from those files into the power query editor. It also allows you to transform that data along with combining.

It works something like this:

  1. Saving All the Files into a Single Folder
  2. Combining them using Power Quer
  3. Merging Data into a Single Table

Make sure to download these sample file from here to follow along and check out this tutorial to learn power query.

Note: For combining data from different Excel files, your data should be structured in the same way. That means the number of columns and their order should be the same.

To merge files, you can use the following steps:

  1. First of all, extract all the files from the sample folder and save that folder at the desktop (or wherever you want to save it).
    combine-data-from-multiple-files-into-one-workbook-by-merging-data-save-files
  2. Now, the next thing is to open a new Excel workbook and open “POWER Query”.
  3. For this, go to Data Tab ➜ Get & Transform Data ➜ Get Data ➜ From File ➜ From Folder.
    combine-data-from-multiple-files-into-one-workbook-by-merging-data-open-from-folder
  4. Here you need to locate the folder where you have files.
    combine-data-from-multiple-files-into-one-workbook-by-merging-data-locate-the-folder
  5. In the end, click OK, and once you click OK, you’ll get a window listing all the file from the folder, just like below.
    combine-multiple-files-into-one-workbook-using-power-query-listing-all-the-file
  6. Now, you need to combine data from these files and for this click on “Combine & Edit”.
    combine-multiple-files-into-one-workbook-using-power-query-combine-and-edit
  7. From here, the next thing is to select the table in which you have data in all the workbooks and yes, you’ll get a preview of this at the side of the window.
    combine-multiple-files-into-one-workbook-using-power-query-select-the-table
  8. Once you select the table, click OK. At this point, you have merged data from all the files into your power query editor and, if you look closely you can see a new column with the name of the workbooks from which data is extracted.
    combine-multiple-files-into-one-workbook-using-power-query-combine-data-in-editor
  9. So, right-click on the column header and select “Replace Values”.
    combine-multiple-files-into-one-workbook-using-power-query-right-click-replace-values
  10. Here in the “Value to Replace” enter the text “.xlsx” and leave “Replace With” blank (here idea is to remove the file extension from the name of the workbook).
    combine-multiple-files-into-one-workbook-using-power-query-enter-value-to-replace-1
  11. After that, double click on the header and select “Rename” to enter a name for the column i.e. Zone
    combine-multiple-files-into-one-workbook-using-power-query-rename-the-folder .
  12. At this point, your merged data is ready and all you need is to load it into your new workbook. So, go to the Home Tab and click on the “Close & Load”.
    combine-multiple-files-into-one-workbook-using-power-query-close-and-load

Now you have your combined data (from all the workbooks) into a single workbook.

This is the moment of JOY, write “Joy” in the comment section if you love to use “Power Query for combining data from multiple files”.

Important Point

In the above steps, we have used the table name to combine data from all the files and add all of it into a single workbook. But not all time you will have the same table name in all the Excel files and at that point, you can use the worksheet name as a key to summarizing all that data.

One more thing:

As I said, you can use a worksheet name to combine data with the power query but there are few more things which I want to share with you and you need to take care of those. Power Query is case sensitive, so when combining files make sure to have the name of worksheets in all the workbooks in the same letters.

The next thing is, to have the same name for the column headers, but here the kicker: The order of the columns doesn’t matter. If column1 in the north.xlsx is column2 in the west.xlsx, Power Query will match it, but you have to have column names the same.

So now, while combining files using power query you can use the worksheet name instead of the table name, and here you have «SalesData» as the worksheet name in all the files.

You select it and click on the «Combine & Edit» and follow all the steps which I have mentioned in the above method.

Why Power Query is the Best Way to Merge Data into a Single File?

Merge Data from Multiple Workbooks When you don’t have the Same Name for Worksheets and data in Tables

This is the hard truth…

…that in some situations, you won’t have the same name for worksheets and not all the data in tables all the time.

Now, what you should be doing in that case?

Well…

…in this case, you must know how you can combine data from all the files and I don’t want to miss to share with this thing with you.

…so without any further ado, let’s get started.

  • First of all, open the “From Folder” dialog box to locate the folder where you have all the files.
  • Now in this dialog box, locate the folder and click OK.

  • After that, click on the “Edit” to edit the table.

  • At this point, you will have a table like below in your power query editor.

  • Next, select the first two columns of the table and click on the “Remove Other Columns” from the right-click menu.

From here, we need to add a custom column to fetch data from the worksheets of the workbooks.

  • For this, go to Add Column Tab and click on the “Custom Column” button. This will open the “Custom Column” dialog box.

  • In the dialog box, enter =Excel.Workbook([Content]) and click OK.

…at this time you have a new column in the table but next, you need to extract data from it.

  • Now, open the filter from that newly added custom column and click OK to expand all the data into the table.

  • Here you have the newly expanded table with some new columns.
  • Now from this new table, delete all the columns except third and fourth.

  • So, open the filter for the column “Custom.Data” to expand it and click OK.

The moment you click OK, you’ll get all the data from all the files into a single table…

you need to make some changes into it to make it PERFECT.

If you notice, all the heading of the column are into data itself…

…so you need to add the column headings.

  • To do this, you need to double click on the header and add a name, or you can right click and select rename it.

The next you need to exclude the headings which you have in the data table.

  • Now open any column’s filter option and unselect the heading name which you have in the column data and click OK after that.

Now our data is ready to load into the worksheet, so, go to the Home Tab and click on the close and load.

Congratulations! you have just combined data from the different workbooks (with different worksheets name and without any table).

This is also important:

At this point, you have merged the data into one table.

But there’s one thing you need to do…

…and that’s applying some formatting to it and making sure that it won’t go away when you update your data.

Here’s what you need to do…

  • First of all, select the column where you have dates (as it is formatted as number right now) and format it as dates.
  • After that, make all the columns wide as per the data you have in them.
  • Here you can also format amount and price as “Currency”. 

But the next thing is to make this formatting fix.

  • For this, go to “Design Tab”, and open properties.
  • Untick “Adjust Column” width and tick mark “Preserve Cell Formatting”.
  • Yes, that’s it.

Now you have a query in your workbook which can combine data from multiple files…

…and merge it into a single workbook…

…even if the worksheet name is not the same or if you don’t have tables.

And yes, you have also made the formatting fix. ?

In the end,

As I said, POWER QUERY is real and if you frequently use to combine data from multiple files then you must use this method…

…as it’s a ONE-TIME setup.

The most important thing is you when you use power query you can even clean the data from those files as well.

I hope this tutorial will help you to Get Better at Excel. But now, you need to tell me one thing.

Which method do you use to combine data from multiple files?

Make sure to share your views with me in the comment section, I’d love to hear from you. And please, don’t forget to share this post with your friends, I am sure they will appreciate it.

You must Read these Next

  • Consolidate Data From Multiple Worksheets: This option can help you to combine data from multiple worksheets into a single one…
  • Unpivot Data using Power Query: In this situation, you need to put some efforts and spend your precious time to make it re-usable…
  • Create a Pivot from Multiple Files: In this post, I’d like to show you a 3 steps process to create a pivot table by using data from multiple…

About the Author

puneet one point one

Puneet is using Excel since his college days. He helped thousands of people to understand the power of the spreadsheets and learn Microsoft Excel. You can find him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.

Skip to content

Как быстро объединить несколько файлов Excel

Мы рассмотрим три способа объединения файлов Excel в один: путем копирования листов, запуска макроса VBA и использования инструмента «Копировать рабочие листы» из надстройки Ultimate Suite.

Намного проще обрабатывать данные в одном файле, чем переключаться между многочисленными книгами. Однако объединение нескольких книг Excel в один файл может быть сложным и долгим процессом, особенно если книги, которые вам нужно объединить, содержат много листов. Итак, как подойти к этой проблеме? Вы будете копировать их вручную или с помощью кода VBA? Или вы используете один из специализированных инструментов для объединения файлов Excel? 

Ниже вы найдете несколько хороших способов, позволяющих реализовать объединение.

  • Самое простое — копировать вручную.
  • Объединение файлов Excel при помощи VBA.
  • Как объединить несколько файлов с помощью Ultimate Suite.

Примечание. В этой статье мы рассмотрим, как копировать листы из нескольких книг Excel в одну книгу. Если вы ищете быстрый способ скопировать данные с нескольких листов на один общий лист, вы найдете подробную инструкцию в другой статье: Как объединить несколько листов в один.

Простой метод — копировать листы руками.

Если вам нужно объединить всего пару файлов Excel, вы можете вручную скопировать или переместить листы из одного файла в другой. Вот как это можно сделать:

  1. Откройте книги, которые мы планируем объединить.
  2. Выберите листы в исходной книге, которые вы хотите скопировать в основную книгу.

Чтобы выбрать несколько листов, используйте один из следующих приемов:

  • Чтобы выбрать соседние листы, щелкните вкладку первого, который вы хотите скопировать, нажмите и удерживайте клавишу Shift, а затем щелкните вкладку последнего. Это действие выберет все листы между ними.
  • Чтобы выбрать несмежные, удерживайте клавишу Ctrl и щелкайте вкладку каждого из них по отдельности.
  • Выделив все нужные листы, щелкните правой кнопкой мыши любую из выделенных вкладок и выберите «Переместить» или «Копировать…» .

  1. В диалоговом окне «Перемещение или копирование» выполните следующие действия:
    • В раскрывающемся списке «Переместить выбранные листы в книгу» выберите целевую книгу, в которую вы хотите объединить другие файлы.
    • Укажите, где именно должны быть вставлены вкладки. В нашем случае мы выбираем вариант вставки в конец списка.
    • Установите флажок «Создать копию», если хотите, чтобы исходные данные оставались оригинальном файле.
    • Нажмите ОК, чтобы завершить операцию.

Чтобы объединить вкладки из нескольких файлов Excel, повторите описанные выше шаги для каждой книги отдельно.

Замечание. При копировании листов вручную помните о следующем ограничении, налагаемом Excel: невозможно переместить или скопировать группу листов, если какой-либо из них содержит «умную» таблицу. В этом случае вам придется либо преобразовать таблицу в диапазон, либо использовать один из других методов, не имеющих этого ограничения.

Как объединить файлы Excel с VBA

Если у вас есть несколько файлов Excel, которые необходимо объединить в один файл, более быстрым способом будет автоматизировать процесс с помощью макроса VBA.

Ниже вы найдете код VBA, который копирует все листы из всех файлов Excel, которые вы выбираете, в одну книгу. Этот макрос MergeExcelFiles написан Алексом.

Важное замечание! Макрос работает со следующим ограничением — объединяемые файлы не должны быть открыты физически или находиться в памяти, в буфере обмена. В таком случае вы получите ошибку во время выполнения.

Sub MergeExcelFiles()
    Dim fnameList, fnameCurFile As Variant
    Dim countFiles, countSheets As Integer
    Dim wksCurSheet As Worksheet
    Dim wbkCurBook, wbkSrcBook As Workbook
 
    fnameList = Application.GetOpenFilename(FileFilter:="Microsoft Excel Workbooks (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm", Title:="Choose Excel files to merge", MultiSelect:=True)
 
    If (vbBoolean <> VarType(fnameList)) Then
 
        If (UBound(fnameList) > 0) Then
            countFiles = 0
            countSheets = 0
 
            Application.ScreenUpdating = False
            Application.Calculation = xlCalculationManual
 
            Set wbkCurBook = ActiveWorkbook
 
            For Each fnameCurFile In fnameList
                countFiles = countFiles + 1
 
                Set wbkSrcBook = Workbooks.Open(Filename:=fnameCurFile)
 
                For Each wksCurSheet In wbkSrcBook.Sheets
                    countSheets = countSheets + 1
                    wksCurSheet.Copy after:=wbkCurBook.Sheets(wbkCurBook.Sheets.Count)
                Next
 
                wbkSrcBook.Close SaveChanges:=False
 
            Next
 
            Application.ScreenUpdating = True
            Application.Calculation = xlCalculationAutomatic
 
            MsgBox "Processed " & countFiles & " files" & vbCrLf & "Merged " & countSheets & " worksheets", Title:="Merge Excel files"
        End If
 
    Else
        MsgBox "No files selected", Title:="Merge Excel files"
    End If
End Sub

Как добавить этот макрос в книгу

Если вы хотите вставить макрос в свою книгу, выполните следующие обычные действия:

  1. нажимать Alt + F11 , чтобы открыть редактор Visual Basic.
  2. Щелкните правой кнопкой мыши ThisWorkbook на левой панели и выберите « Вставить» > « Модуль» в контекстном меню.
  3. В появившемся окне (Окно кода) вставьте указанный выше код.

Более подробная инструкция описана в разделе Как вставить и запустить код VBA в Excel .

Кроме того, вы можете загрузить макрос в файле Excel, открыть его в этой книге (включить выполнение макросов, если будет предложено), а затем переключиться на свою собственную книгу и нажать Alt + F8 для его запуска. Если вы новичок в использовании макросов в Excel, следуйте подробным инструкциям ниже.

Как использовать макрос MergeExcelFiles

Откройте файл Excel, в котором вы хотите объединить листы из других книг, и выполните следующие действия:

  1. Нажмите комбинацию Alt + F8, чтобы открыть окно диалога.
  2. В разделе « Имя макроса» выберите MergeExcelFiles и нажмите «Выполнить».

  1. Откроется стандартное окно проводника, вы выберите одну или несколько книг, которые хотите объединить, и нажмите «Открыть» . Чтобы выбрать несколько файлов , удерживайте нажатой клавишу Ctrl, указывая на их имена.

В зависимости от того, сколько файлов вы выбрали, дайте макросу несколько секунд или минут для их обработки. После завершения всех операций он сообщит вам, сколько файлов было обработано и сколько листов было объединено:

Как объединить несколько файлов с помощью Ultimate Suite.

Если вам не очень комфортно с VBA и вы ищете более простой и быстрый способ объединить файлы Excel, обратите внимание на инструмент «Копирование листов (Copy Sheets)» — одну из более чем 60 функций, включенных в невероятно функциональную программу Ultimate Suite for Excel. Она работает в версиях Excel 2010-2019.

С Ultimate Suite объединение нескольких файлов Эксель в один так же просто, как раз-два-три (буквально, всего 3 быстрых шага). Вам даже не нужно открывать те из них, которые вы хотите объединить. И это могут быть два файла или несколько — не важно.

  1. Открыв главную книгу, перейдите на вкладку «Ablebits Data» и нажмите «Копировать листы (Copy Sheets)» > «Выбранные в одну книгу (Selected Sheets to one workbook)».

  1. В диалоговом окне выберите файлы (а в них — листы), которые вы хотите объединить, и нажмите «Далее (Next)» .

Советы:

  • Чтобы выбрать все листы в определенной книге, просто поставьте галочку в поле рядом с именем книги, и все они в этом файле будут выбраны автоматически.
  • Чтобы объединить листы из закрытых книг, нажмите кнопку «Добавить файлы…» и выберите столько книг, сколько нужно. Это добавит выбранные файлы только в окно копирования, не открывая их в Excel.
  • По умолчанию копируются все данные. Однако, в разных листах можно выбрать разные диапазоны для объединения. Чтобы скопировать только определенную область, наведите указатель мыши на имя вкладки, затем щелкните значок    и выберите нужный диапазон. 
  • При необходимости укажите один или несколько дополнительных параметров и нажмите «Копировать» . На снимке скриншоте а ниже показаны настройки по умолчанию: Вставить все (формулы и значения) и Сохранить форматирование.

Дайте мастеру копирования листов несколько секунд для обработки и наслаждайтесь результатом!

На этой странице есть подробное описание всех возможностей работы мастера копирования.

Чтобы поближе познакомиться с этим и другими инструментами для Excel, вы можете загрузить ознакомительную версию Ultimate Suite.

Итак, я надеюсь, вы получили ответ на вопрос — как быстро объединить несколько файлов Excel в один.

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

You have several Excel files that make it harder for you to access data. You keep switching between different opened files, and this process takes a lot of your time. You are well aware that it is a lot easier to process data in a single file instead of switching between numerous sources. Then comes the question, how can I merge all these files into one comprehensive file? It is a troublesome and long process trying to combine different Excel files into one file when you factor in the number of worksheets found in one workbook. There are various ways of merging Excel files.

In this article, we discuss how to merge multiple Excel files into one file. Let’s get started.

Method 1: Combine multiple workbooks into one workbook with the Move or Copy function

1. If you want to merge all the existing files into a new Excel workbook, create the new Excel workbook and open it. But if you’re going to combine all of them into a current workbook, open that workbook.

2. Open all the Excel files you want to merge. You need to open all files to be able to combine them into one. Instead of doing it manually, select all the files and press the enter key on your keyboard. To select multiple files that are non-adjacent, hold the Ctrl key and click the files one by one. For adjacent files, hold the Shift key and click on the last file to select them all.

3. Maximize the first file you want to merge.

4. Right-click the worksheet you want to merge, then select Move or Copy.

5. On the pop-up window, click ‘Pick from Drop-down List.’ All the Excel files opened on your computer will be displayed here

6. Select the excel file you want to merge other files into in the ‘To book’ drop-down arrow.

7. To merge excel files, check the Create a copy checkbox.

8. In the Before Sheet section, select ‘move to end and click OK. It will create a copy of the worksheet in the destination file.

9. Repeat all the above steps for all the remaining files and save your file.

Method 2: Combine multiple workbooks into one with VBA

1. Open a new workbook that will act as a master workbook.

2. Press Alt + F11 to the VBA page

3. Click on the Insert tab. Next, select the Module tab.

4. Copy and paste the macro code below.

Sub GetSheets()

Path = "C:UsersdtDesktopdt kte"

Filename = Dir(Path & "*.xlsx")

  Do While Filename <> ""

  Workbooks.Open Filename:=Path & Filename, ReadOnly:=True

     For Each Sheet In ActiveWorkbook.Sheets

     Sheet.Copy After:=ThisWorkbook.Sheets(1)

  Next Sheet

     Workbooks(Filename).Close

     Filename = Dir()

  Loop

End Sub

Click here for more code.

5. After this, it is time to initiate the command by pressing F5 to run the excel macro code. Doing this will open a file and then copy the data. It will paste the same in your new workbook. Close the workbook.

Method 3: Merging Microsoft Excel files as CSV files.

1. Open the excel files.

2. Go to the Menu bar. Click File. Then Save As.

4. In the Save as type, there is a drop-down list. Select CSV from the list.

5. Do this for all the files you want to merge, and then place all the CSV files into one folder.

6. Open the command prompt then navigate to your folder. Type the following command to merge all CSV files in the folder into a new CSV file. Copy *.csv newfile.CSV

7. After creating the new file, open the new CSV file in Microsoft Excel.

8. Save it as an Excel file.

Method 4: Using Power Query

The Power Query method is the best way to merge data since you only need to store all the excel files in a single folder. You can then use that folder to load data from files into the Power Query Editor. It also allows you to transform data while combining.

However, for the Power Query editor to merge Excel files, you need to understand that all data should be structured in the same way. That means the number of columns and their order should be the same. Below are steps to follow when merging files with the Power Query application.

Power query allows to import, edit and consolidate the data. It can also be used to import and combine multiple excel files into one folder.

With the Same Name of Worksheets and Tables

1. Move all the files into the new folder that you want to combine.

2. In Excel go to the Data tab

3. Press Get Dat > From File > From Folder

4. Browse and select the folder path

5. Press Ok

6. If files are ready to combine press Combine & Load

7. If you want to manipulate the data, then press the Transform Data button. This will open the query editor where you can work on the data.

From here, select the table in which you have data in all the workbooks. A preview of this will appear at the side of the window.

8. Once you select the table, click OK to merge data from all the files into your Power Query editor. You will see a new column with the name of the workbooks from which data is extracted.

9. Right-click on the column header and select “Replace Values”.

10. Enter the text “.xlsx” in the Replace Values box and leave the “Replace With” box blank. The idea here is to remove the file extension from the name of the workbook.

11. Next, double-click on the header and select “Rename” to enter a name for the column.

12. At this point, your merged data is ready and you only need to load it into your new workbook. To perform this, go to the Home Tab and click on Close & Load. Now you will have your combined data from all tables or workbooks with the same name in a single workbook.

Note: You will not have the same table name in all the excel files all the time. At that point, you can use the worksheet name to combine data with the Power Query method. However, you should note two points when using the worksheet name to combine data with the power query method:

  • Power Query is case-sensitive. So, you should have the same letter names of worksheets in all the workbooks.
  • You should have the same name for the column headers, but the order of the columns does not matter. If column1 in the north.xlxs is column2 in the west.xlxs, Power Query will match it, but you need to have the same column names.

Therefore, when combining files using the power query, you can use the worksheet name instead of the table name. You only need to select the worksheet name, click on the Combine & Edit, and follow all the steps outlined above from step number 6.

When You Don’t Have the Same Name of Worksheets and Tables.

In some situations, you can lack the same name of worksheets and tables in the excel files. In this case, you must know how to combine data from these different worksheets and tables into one file, following these steps:

1. Open the “From Folder” dialog box to locate the folder where you have all the files and click OK.

2. After that, click on the “Edit” to edit the table.

3. Once the table and Power Query editor open, select the first two columns of the table and click on the Remove other Columns from the right-click menu.

4. From here, you need to add a custom column to fetch data from the worksheets of the workbooks. To do this, go to Add Column Tab and click on the Custom Column button. The step will automatically open the Custom Column in the dialog box.

5. In the dialog box enter the formula below and click OK.

                 =Excel.Workbook([Content])

6. You will have a new column in the table from which you need to extract data. Open the filter from that newly added custom column and click OK to expand all the data into the table.

7. You will see a newly expanded table with some new columns. Delete all columns from the new table except the third and the fourth column.

8. Now open the filter for the Custom Data column to expand it and click OK.

Once you click OK, you will get all the data from the files having been merged into a single table. Though, if you notice all the headings of the columns are in the data itself, you need to add the column headings as follows;

  • Double-click on the header and add a name. You can also right-click and select Rename It.
  • Exclude the headings you have in the data table. For this, open any column’s filter options and unselect the heading name which you have in the column data and click OK after that. After you click ok, your data is ready to load into the worksheet.
  • Go to the Home Tab and click on Close and Load. This allows you to combine data from different workbooks that had different worksheets names.

At this point, you have already merged the data into one single file. You should then apply some formatting to avoid losing a single file of your data when updating it. To format a single file, you can use these steps:

  • Go to Design Tab and open Properties.
  • Untick the Adjust Column width and tick the Preserve Cell Formatting

Conclusion

The above tips help you to be organized and save time. Whether you decide to merge data in excel into a single file, or if you prefer to spread your work across multiple files, either of the methods above will help you. Excel offers immense features such as an in-built tracking feature that keeps track of any changes made in your files. So, losing your original data should not be a cause of dilemma.

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.

Skip to content

How to Merge Two Spreadsheets in Excel (Consolidate) – 2023

How To Merge Two Spreadsheets in Excel (Consolidate) – 2023

We frequently need to summarize data from multiple Excel files or Excel sheets.

It is difficult to use formulas to combine multiple Excel files into a single sheet.

Formulas are prone to mistakes 🚧

Excel provides clever techniques for combining data from multiple sheets or excel files into a single sheet.

One of them is Excel consolidation 😍

You can practice with me by downloading the Excel workbooks here.

Let’s get started. 👍

Combine Excel sheets with ‘Consolidate’

First, let’s learn how to combine data from multiple sheets.

Here we have regional sales data for 4 weeks.

Week 1 sales
Week 2 sales
Week 3 sales
Week 4 sales

Each week’s sales are in its own Excel sheet in the same workbook.

Product names and regions are not in the same order 🤔

Make sure that no data list contains any blank rows or columns⚠️

Kasper Langmann, Microsoft Office Specialist

Now we want to combine all the data and create the monthly sales table (for all 4 weeks).

We will add a new sheet as “Master”. This sheet will serve as the destination sheet for the consolidated data.

  1. Select a cell in that master sheet to place our sales summary and go to the data tab.
Merge sheets - Go to the data tab
  1. Select “Consolidate” from the data tools group.

Then, you can see the “consolidate” dialog box.

Dialog box to consolidate data
  1. Select the consolidate method from the “Function box”.

In this example, we want to get the total of all the sheets. So, we select “Sum”.

There are several functions to combine Excel sheets such as SUM, COUNT, AVERAGE, MAX, MIN, PRODUCT, etc.

As we want to combine data to get the total of multiple worksheets, we select the “SUM” function.

Kasper Langmann, Microsoft Office Specialist
Functions to merge data in Microsoft Excel
  1. Click the collapse button of the reference box.

Then click on a single worksheet that contains merging data and select the data in that Microsoft Excel sheet. In this case, we first select sales data in the “Week 1” sheet.

Click collapse button to select source data to combine sheets
Selecting sales data in Week 1 sheet
  1. Click the expand dialog button and click the “Add” button. Then the data range will be added to the “All references”.
Click the Expand button

Repeat this step to get all the data in all the worksheets.

Pro Tip!

When you click on the other Excel sheets to get merging data, look at the reference!

Microsoft Excel will apply the previous cell range for the new worksheet as the reference.

If the data in all the sheets are in the same structure and the same layout, you can just click the “Add” button after you select the next worksheet 🥳

Now, it should look like this.

All references from multiple sheets
  1. Check the boxes for “Top row” and “Left column” to add labels to the merged data table. Then all column headers and row labels will be copied to the merged data table.
Adding row and column labels

You must make sure the unique labels are the same in merge sheets.

Microsoft Excel will show the unique labels as separate column headings if they contain any typos or differences⚠️

Kasper Langmann, Microsoft Office Specialist
  1. Check the box – “Create links to source data” and click “Ok”.
Combine data in Microsoft Excel - create link to source data

Do you want to manually update consolidated data in the master spreadsheet?

Then do not check the box – “Create links to source data”.

Kasper Langmann, Microsoft Office Specialist

Microsoft Excel will generate a consolidated data report in a single sheet by combining all the data of the selected sheets of the Excel file.

Summary of the Excel file.

Now you know how to combine data in one file.

Combine multiple Excel files with ‘Consolidate’

In reality, most of the time we collect data in multiple files.

So, we need to combine multiple excel files to get the consolidated data 🤨

In Microsoft Excel, we can combine data from multiple workbooks as well 🤗

  1. To merge Excel files, first, open all the Excel files to be merged. Before you start the process, it is better to save all the files in the same folder.
Open all the Excel workbooks
  1. Create a new workbook and follow steps 1- 3 and 6-7 to combine excel sheets in the new Excel workbook.

Now, the “consolidate” dialog box should look like this.

Following steps 1-3 and 6-7 that are used to combine data from multiple sheets in the same Excel workbook.
  1. Click the collapse button in the reference box and select the data ranges in Excel files one by one.

If the Excel spreadsheets are closed, click “Browse…” to locate the workbooks. You can see the folder path to the Excel workbook in the reference box. Then, manually enter the cell range after the exclamation mark of the folder path.

Browse and select the folder path
All references show file path to each workbook.

When you click “Ok”, you can get the data from separate files to one workbook.

Combined workbook - Merge workbooks

Pro Tip:

If you want to quickly go to the cell ranges of each workbook, you can apply name ranges to those ranges.

It is superfast and more accurate💪🏻

You can read the named ranges article to learn more about it.

That’s it – Now what?

You no longer need to manually enter formulas in the master spreadsheet to prepare a summary 🤩

This is only one of the many ways to merge data from several Excel sheets or files.

Do you know that you can combine multiple worksheets using VBA codes?

Yes, you can combine multiple excel files using VBA too.

You can access my free 30-minute online course on “Vigorous VBA” by clicking here 🧑🏻‍🎓

Other resources

The Consolidate tool in Microsoft Excel appears to be a Pivot Table.

However, Pivot Tables offer more flexibility than Excel Consolidate. Therefore, use Pivot Tables if you need more flexibility to make changes to the summary table.

You can read our articles about power query and VBA codes and use them to merge files in Microsoft excel 👍

Frequently asked questions

Yes, you can combine multiple files.

  1. Open all the files.
  2. Create a new Excel spreadsheet and select a cell where you want to have the upper left cell of the merged data.
  3. Click the “Consolidate” in the “data tab”.
  4. Select the function to combine multiple files.
  5. Pull data from multiple excel files by clicking the collapse button in the reference box. Click “Add” each time you select data from a new Excel spreadsheet.
  6. Click “Ok”.

It is one of the Microsoft Excel features to merge data into one file from multiple sheets or multiple files.

It can merge several sheets or several Excel spreadsheets easily and accurately into a new sheet.

  1. Copy the data from multiple sheets into one sheet.
  2. Select the data in the entire sheet.
  3. Go to the “Remove duplicates” in the Data tab.
  4. If you have copied headers from all the files, do not check the “My data has headers”.
  5. Click “Ok”. Now, data in separate sheets are combined into one sheet without duplicates.

Kasper Langmann2023-01-09T19:23:33+00:00

Page load link

Понравилась статья? Поделить с друзьями:
  • Merge excel files как
  • Merge excel cells vba excel
  • Merge duplicates excel скачать
  • Merge doc in word
  • Merge data with excel