30 Advanced Excel Tips for 2026

Excel Champs / Pivot Table / How to Create a Pivot Table using Multiple Files in Excel
By Puneet Gogia (Microsoft MVP)

How to Create a Pivot Table using Multiple Files in Excel

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

Put all the workbooks in one folder, then go to Data → Get Data → From File → From Folder and select that folder. Click Combine → Combine & Transform Data, pick the sheet or table that holds the data in the first file, and click OK. Power Query stacks every file into one list and adds a Source.Name column showing which file each row came from.

In the Power Query editor, choose Home → Close & Load To → PivotTable Report and click OK. The pivot table reads straight from the query, with no copy of the combined data on a sheet, and you can use Source.Name as a row field or filter to split totals by file.

To update, add new workbooks to the folder or overwrite old ones, then click Data → Refresh All (Ctrl + Alt + F5). Each refresh reads whatever is in the folder at that moment, so a replaced monthly export is picked up as long as its sheet name and headers match.

Get Data is built into Excel 2016 and later; early Excel 2016 builds show it as Data → New Query → From File → From Folder. Excel 2010 and 2013 need the free Power Query add-in, which adds its own Power Query tab.

If refresh stops with The key didn't match any rows in the table, one file names its sheet differently from the first file; rename the sheet so they match. Files in subfolders are included too, along with the hidden ~$ lock file Excel creates while a workbook in the folder is open, so filter the Folder Path or Name column in the first step to keep only the files you want.

A Pivot Table is one of the best ways to summarize data.

You can create a summary report within seconds from thousands of rows of data. But while working with data in the real world, not everything is perfect.

And today, I want to share with you a common problem which we all face.

Before I start, I want to say thanks to Raman Girdhar for his question. He has been following up with me for quite a long time.

Sometimes we receive or capture our data in different workbooks, and in that case, creating a pivot table needs some extra effort for combining those multiple workbooks into one.

Only after that, we can create a pivot table.

So in this post, I’d like to show you a three-step process to create a pivot table by using data from multiple workbooks.

Steps to Create a Pivot Table Using Data from Multiple Workbooks

Important: For this, we need to use Power Query, so make sure you have Power Query in your Excel version. In Excel 2016 and later (including Microsoft 365), it’s built in on the Data tab (Get & Transform Data), and for Excel 2010 and 2013, you need to install the add-on.

Check this out: Power Query Tutorial 

Here I have four different workbooks with sales data for different zones. You can download these files from here to follow along.

And make sure you have all these files in a single folder.

Step 1 – Combine Files using Power Query

First of all, we need to combine all the files into one file with power query.

  • Go to Data Tab -> Get Data -> From File -> From Folder (in Excel 2016: Data Tab -> New Query -> From File -> From Folder).
  • Now, from the folder selection window, click on “Browse” and select the folder where you have all the files.
  • Click OK.
  • Excel shows the list of files in the folder. Click Combine -> Combine & Transform Data (Combine & Edit in Excel 2016), and you’ll get a “Combine Files” window.
  • And from that window, select the worksheet that has your data in all the workbooks. (Quick Tip: Make sure to have the same worksheet name in all the workbooks.)
  • Once you click OK, it will load all the data from the workbooks into the Power Query Editor.

Step 2 – Prepare Data for the Pivot Table

Now, we need to make little changes in our data to make it ready for a pivot table.

  • If you look at the data, we have got an extra column here with the name of the source file.
  • Right click on this column and select Split Column -> By Delimiter.
  • From the delimiter window, select Custom, add “-” as a delimiter, and select “Left-most delimiter”.
  • Click OK.
  • After that, delete the second column.
  • Now, rename the first column.
  • One more thing, right-click on the first column again and go to Transform -> Capitalize Each Word.
  • And now your data is ready. So, click on Close & Load.

Step 3 – Insert the Pivot Table

At this point, we have a new worksheet in our workbook with the combined data from all four files.

Now, it’s time to create a pivot table from it.

  • Select the table and go to Insert Tab and click on the Pivot Table button.
  • Here you’ll get the Insert PivotTable window.
  • Click OK on the Insert PivotTable window, and you’ll get a new pivot table in your workbook.

Congratulations! You have successfully created a new pivot table from different files.

Refresh Pivot Table

I’m sure you are thinking about how to refresh your pivot table after updating source files.

It’s simple. To refresh your pivot table, you need to refresh the query first so that the data from the source files is updated in the table you created with Power Query. And after that, you can refresh your pivot table.

But the simple and best way is to use the Refresh All button on the Data tab. It will refresh both (Pivot Table + Query).

There’s one catch: queries refresh in the background by default, so the pivot table can refresh before the query has loaded the new data. If the pivot table doesn’t show the new data, click Refresh All again, or turn off background refresh for the query (Data ➜ Queries & Connections ➜ right-click the query ➜ Properties ➜ untick “Enable background refresh”) so one click updates both in the right order.

And when you add a new file to the folder, Refresh All picks it up as well, as long as it has the same sheet name and columns.

Create the Pivot Table without Loading the Data to a Sheet

If you have a lot of data, you don’t need to load the combined data to a worksheet at all. In the Power Query Editor, click the small arrow on Close & Load and select Close & Load To. Then select PivotTable Report and click OK. Excel creates the pivot table straight from the query, which also keeps your workbook smaller.

Important Points

Here I have listed some points which you need to remember while using power query for a pivot table.

  • Files should be in a single folder, and you shouldn’t move or rename that folder (or update the path in the query’s Source step if you do).
  • Data should be in the same format in all the files. Otherwise, you need to make it usable after combining it.
  • The name of the worksheets should be the same in all the files.
  • Make sure you don’t have an error in any file. Or you can use the “Skip files with errors” option in the Combine Files window.
  • Don’t rename any workbook, as the zone name comes from the file name.
  • Keep only the data files in that folder. Any other file, including a temporary file that starts with “~$” while a workbook is open, can make the combine step fail.

Frequently Asked Questions

Can I combine only some files from the folder?

Yes. In the file list that appears after you select the folder, click Transform Data instead of Combine, filter the Name or Extension column (for example, only .xlsx files), and then click the Combine Files button in the Content column.

What if the sheet names are different in each file?

The Combine Files window uses the sheet you pick in the first file for all the files, so a different sheet name breaks the combine step. Rename the sheets so they match, or keep the data in Excel tables with the same table name in each file.

Does this work in Excel for Mac?

Yes, in Microsoft 365 for Mac, Power Query can import from a folder (Data ➜ Get Data ➜ From File ➜ From Folder). Older Mac versions of Excel don’t have it.

25 thoughts on “How to Create a Pivot Table using Multiple Files in Excel”

  1. Hi Puneet,

    Kindly suggest if we can multiple worksheets i.e. only one heading will be common in all worksheets, rest all headings will be different.
    I need to compile all types of data from different worksheets into single pivot table. It should work like multiple vlookups w.r.t first workbook.

    Kindly suggest.

    Thanks,
    Udit

    Reply
  2. Punett,

    Thanks. Easy to follow. Super clear and ready to use your tips.

    Reply
  3. Hi!
    Thank you for explaining this!

    Is that possible to refresh the data if I delete a workbook and insert the same type of workbook with the same name on the folder where the query is? The problem is because I get a monthly exported excel files from another system which gets updated once a month. All the files looks the same, but they are from different teams in the department, in you case like the different zones. The only thing which would be different are the files time which I have to export. 🙂

    Thank you for your time!
    Best,
    Yasmin

    Reply
  4. Great Article. Can you add another file later on? For example say you have files for Fiscal Year (FY) 16/17, FY 17/18 and FY 18/19 and later on you wanted to add FY 19/20. How would you do this?

    Reply
  5. Thanks for your instructions. I am new to Queries and have been experimenting with combining data from multiple workbooks (Office 365). One thing I just found out is that once you establish a link to a folder, any files in new subfolders will be included. This can be advantageous for organizing source files. Also, do you have any tips for using slicers?

    Reply
  6. Can we create different charts by using single pivot? Now I’m using individual pivot for different chart so it’s consuming more size. Please suggest if any

    Reply
  7. Hi Puneet, Thank you so much for posting this on my request.
    I have a query. please refer to your step where you have asked about the “Combine Files” window. I am getting this window, however, I am not getting the “combine” button at the bottom. I am only getting rest of the three buttons – “Load”, “Edit” and “Cancel”. I am using MS Excel 2013. Any alternate for 2013 version ?

    Reply
  8. Hey Puneet,
    I am using pivot table as a part of my task. Now I was able to calculate percentages, multiplication, subtraction, addition etc., but unable to apply “if condition with 2 and more conditions” along with conditional formatting. Can you please assist on this.
    Regards,
    Sail.

    Reply

Leave a Comment