Combining multiple files from one folder is already supported built-in through the graphical interface of Power Query when use you Get Data from Folder. However, if you have one Excel file, with multiple sheets with the same structure but different data, you cannot use that option. There is a very little but useful trick that you can use to get data from multiple sheets dynamically rather than manually one by one from each sheet. This post is about that technique.
Sample Excel file
I have a sample excel file with multiple sheets, and the sheets contain the same data structure, but the actual data rows are different. Here is the screenshot of that file;
Get Data from Excel
In Power BI Desktop, You can start by Getting Data from Excel;
In the Navigator window, you will see multiple sheets or even tables, all you need to do is just to select one of those (doesn’t matter which one). and then click on Transform Data.
Get the List of All Sheets
In the Query Editor window, right-click on the Navigation Step and choose Delete Until End (Note that this action will remove this step and all steps after with no undo option)
Now you should see only one step (named probably as Source), and the preview of data should be all Excel sheets and tables in that Excel file:
Sometimes, you want to select all sheets, sometimes, you might want to select tables only. Sometimes you might want to filter sheet names that have specific characters etc. All of those options are possible through the headers of each column;
Apply all the filterings that you need. In my case, I just want to select everything.
At this stage, we just need to keep the Data Column, and remove anything else (unless the name of the sheet is also a valid data that you want to process, which is not the case in my example);
Now you can expand the Data column to the underlying structure;
This action will combine the data from all sheets into one;
That’s it, all the data from multiple sheets are combined. You might need, however, to clean the data, remove duplicate headers, etc to have a clean combined table as a result.
Note that this solution is fully refreshable, either through a gateway, or without the gateway is the Excel file is located on a cloud data source. Here I explained, how you can refresh it without the gateway if the file is on OneDrive for Business.