How to Automate Monthly Excel Imports from a Folder in Power BI
- Power BI's Folder connector lets you point to a folder of Excel files and combine them all into one table automatically — drop a new monthly file in, hit refresh, and it's included.
- The entire automation is built inside Power Query, not DAX — no formulas are needed, and the steps are mostly point-and-click.
- Your Excel files must have an identical structure across every file: same column names, same sheet name, same column order. One file that's structured differently will break the whole combination.
- Always click "Combine & Transform Data", not plain "Combine" or "Load" — the transform step is where you fix headers, set data types, and review what Power Query actually pulled in.
- Once set up, the entire pipeline is self-updating. You never touch Power Query again for new monthly files — you just refresh the report.
If your team receives a new Excel file every month, and someone has to manually open Power BI and re-import that file each time, this guide removes that manual step permanently. The setup takes about 15 minutes the first time. Every month after that, dropping a new file into a folder and clicking refresh is the entire process.
What This Actually Does Under the Hood
Before jumping into the steps, it's worth understanding the mechanism, because it's what makes the whole thing work reliably over time.
Power BI's Folder connector doesn't import the files directly into your report. Instead, it reads the contents of a folder on your computer (or SharePoint, or OneDrive), sees every file that's in there, and then applies the same transformation steps to each one. Think of it like a recipe: you describe once what to do with a single file, and Power Query applies that same recipe to every file in the folder automatically — including any new ones that weren't there when you first set it up.
This means two things. First, adding a new monthly file is genuinely automatic — you don't need to reconfigure anything. Second, the structure of every file matters a lot, because the recipe you defined for the first file gets applied identically to every other file. If February's file has a column called "Revenue" but January's calls the same column "Sales," the combination will break, because the recipe is looking for one specific column name and one of the files doesn't have it.
Before You Start: Prepare Your Folder
This step takes five minutes and saves you from debugging later.
Step 1: Create a dedicated folder
Create a single folder specifically for these monthly files. Don't use a folder that also contains unrelated files — the Folder connector picks up everything with a matching extension, so any stray Excel files in that folder will also get pulled in, whether you want them or not.
A clean path with no spaces in the folder name is best practice: C:\Data\MonthlySales works cleanly. C:\Finance Team\Monthly Reports (Excel) can occasionally cause path-reading issues depending on your Windows setup.
Step 2: Make sure every file has identical structure
This is the single most important requirement, and the most common reason the setup breaks. Every Excel file in your folder needs:
- The same sheet name across all files (e.g., always "Sheet1" or always "SalesData" — not "Sheet1" in January and "Jan 2026" in February)
- The same column names in exactly the same columns, across every file
- The same column order — Power Query matches by position as well as name in some configurations
- No merged cells, no decorative header rows, no summary rows at the bottom — just clean tabular data starting at row 1
If your files have a title row above the actual headers (like "Monthly Sales Report — January 2026" in row 1, with actual column headers in row 2), that's fixable inside Power Query, but easier to just remove before importing.
Step 3: Use a consistent naming convention
Name your files so they sort in a logical order. A format like Sales_2026-01.xlsx, Sales_2026-02.xlsx, Sales_2026-03.xlsx works well — it sorts chronologically by filename, which matters because Power Query uses the first file alphabetically as its "sample file" when it builds the transformation logic. If your files sort in a weird order, your sample file might be an unusual one.
Connecting Power BI to the Folder
With your folder prepared, open Power BI Desktop.
Step 4: Open Get Data and select Folder
On the Home tab of the ribbon, click Get Data. In the dropdown, look for "Folder" — it's usually listed under the "File" category. If you don't see it immediately, click "More..." at the bottom of the dropdown to open the full Get Data window, type "Folder" in the search bar, and select it from the results. Click Connect.
Step 5: Enter the folder path
A small dialog appears asking for the folder path. You can either type it directly if you know it, or click Browse to navigate to your folder the normal way. Once you've selected the folder, click OK.
Step 6: Review the file preview
Power BI now shows you a preview window. This looks like a table, but it's not your actual sales data — it's a list of the files Power BI found in that folder. You'll see columns like Name (the filename), Extension (.xlsx), Date Modified, and Folder Path.
This is a useful moment to pause and check. Are all the files you expected listed? Are any unexpected files in there? If you see a stray file that shouldn't be included, this is the time to remove it from the folder before proceeding.
Step 7 (i): Click the Combine dropdown
At the bottom-right of the folder preview window, you will see several action buttons: Combine, Load, and Transform Data.
It is critical not to click plain Load or plain Transform Data here. Clicking those buttons will only import the folder's file metadata (the list of filenames, file paths, and dates modified) rather than the actual tabular rows inside your Excel workbooks. To unpack and append the records inside the files, click the arrow on the Combine button.
Step 7 (ii): Select "Combine & Transform Data"
From the expanded Combine dropdown menu, select "Combine & Transform Data."
Never choose plain "Combine & Load." Jumping straight to Load skips the Power Query Editor, which prevents you from validating column headers, correcting date and number data types, or filtering out duplicate header rows created across monthly files. Choosing "Combine & Transform Data" ensures Power Query constructs the necessary helper queries and lets you review the combined schema before loading it into your data model.
The Combine Files Dialog
Step 8: Select the right sheet from the sample file
A new dialog appears called Combine Files. Power Query has picked one of your Excel files as a "sample file" — by default, it uses the first file alphabetically. On the left side of this dialog, you'll see a list of objects it found inside that sample file: typically, this includes the sheet names and any named Excel Tables.
This is the decision that tells Power Query what to look for inside every file. If your data lives on a sheet called "Sheet1," click Sheet1. If you formatted your data as a proper Excel Table (recommended), you'll see the table's name — click that instead. A preview of the first few rows of that sheet or table appears on the right side so you can confirm it looks right.
If your data is formatted as a named Excel Table (Insert → Table in Excel) rather than just plain sheet data, always select the table rather than the sheet. Named tables are more reliable for this kind of automation, because Power Query matches them by name rather than by position on the sheet — which means even if someone accidentally adds a row above the table in one month's file, the table itself is still found correctly.
Click OK once you've confirmed the right selection.
Inside Power Query Editor
Power Query now opens with your combined dataset and the automatically generated helper queries. Let's examine what was created and ensure the headers and data types are verified before loading into your model.
Step 9: Understand what Power Query auto-generated
Look at the Queries pane on the left. You'll notice Power Query didn't just create one query — it created several, grouped under "Helper Queries":
- Transform Sample File — this is the set of transformation steps applied to your sample file, and therefore to every other file in the folder
- Transform File — a function that applies those same steps to each binary file
- Parameter1 — points to the sample file
You'll mostly work inside the main query (the one with your actual combined data), but if you need to add a transformation step that applies to every single file, you'll add it inside Transform Sample File rather than the main query. This distinction matters more as you get into more advanced transformations.
Step 10: Check and promote the headers
Look at the column headers in the main query. If you see "Column1," "Column2," "Column3" instead of your actual column names, it means Power Query didn't automatically detect your header row. Go to the Home tab and click "Use First Row as Headers." This promotes the first data row to become the column names instead.
If your headers are already showing correctly, Power Query handled it automatically. Either way, double-check that the column names match what you actually named them in Excel.
Step 11: Set the correct data types
Click on the small icon at the top-left of each column to see and set its data type. Dates should be set to Date (not Text). Sales figures should be Whole Number or Decimal Number (not Text). Names and categories should be Text.
Getting data types wrong here is one of the most common causes of broken DAX measures later on. A date column stored as text won't work with any time intelligence functions. A number stored as text won't aggregate correctly. Fix them now, while you're already in Power Query, rather than troubleshooting confused measure results three steps later.
Step 12: Remove columns you don't need
Power Query automatically adds a "Source.Name" column containing the filename each row came from. This column is genuinely useful — it lets you trace back exactly which monthly file a specific row originated from, which helps enormously when you're debugging a data anomaly later. Keep it.
However, Power Query sometimes also pulls in other metadata columns you don't need. Select and delete any column that isn't either your actual data or the Source.Name. Keeping unnecessary columns adds noise to your model and slows down refreshes for no reason.
Step 13: Filter rows you don't want
If your files contain any header rows that got duplicated during the combination (a common issue), you'll see rows where your column headers appear as data values. Filter those out by clicking the dropdown on any column that should contain data values (like a Sales column) and deselecting any rows that contain the column header name as a value instead.
Also filter out any blank rows at this stage — click the dropdown on a key column and uncheck "(null)" to remove rows where that column is empty.
Loading and Testing
Step 14: Rename the query
In the Queries pane on the left, right-click the main query and rename it to something meaningful — "MonthlySales" or "CombinedOrders" rather than the default folder-path-derived name. This name becomes the table name in your data model, and a readable name makes everything downstream easier.
Step 15: Close & Apply
Click Close & Apply on the Home tab of Power Query Editor. Power BI will now run through all the files in your folder, apply the transformation steps to each one, combine them into a single table, and load the result into your data model.
Depending on how many files you have and how large they are, this might take a few seconds or a couple of minutes. You'll see a loading progress indicator while it runs.
Step 16: Build a simple test visual
Before declaring the setup done, do a quick sanity check. Add a card visual showing a row count, and add a table showing a handful of rows. Does the total row count look right given how many files and rows you have? Do you recognize the data values? Is the Source.Name column showing the correct filenames?
If something looks off, go back into Transform Data and check the Applied Steps for anything that might be filtering out more rows than intended.
The Part That Makes It Automatic
Step 17: Drop a new file in and refresh
This is the payoff. Take a new monthly Excel file — formatted the same way as all the others, with the same sheet name and column structure — and drop it into your folder. Then, in Power BI Desktop, click Refresh on the Home tab.
Power BI will re-read the folder, find the new file, apply the same transformation steps to it, and add its rows to the combined table automatically. No dialog boxes. No reconfiguration. No touching Power Query.
That's the whole automation.
For Cloud Refresh: Use SharePoint or OneDrive Instead of a Local Folder
One important limitation: a local folder path like C:\Data\MonthlySales only works when you're refreshing inside Power BI Desktop on your own machine. If you publish your report to Power BI Service and want it to refresh on a schedule automatically, a local path won't work — the cloud service can't reach a folder on your laptop.
The fix is to use a SharePoint folder or OneDrive as your folder path instead of a local one. The connector works almost identically — instead of selecting "Folder" in Get Data, select "SharePoint folder", paste your SharePoint site URL (just the base site URL, not the full folder path), and navigate from there.
Any files you drop into that SharePoint folder then trigger the same automatic combination behavior, and because SharePoint is cloud-hosted, Power BI Service can reach it during a scheduled refresh without needing a data gateway.
The M Code Behind It (For When You Need More Control)
Power Query records everything as M code in the background. You'll never need to write M from scratch for the basic setup — the UI handles it all — but knowing what the code looks like helps when you need to troubleshoot or adjust behavior beyond what the UI exposes.
Click Advanced Editor on the Home tab of Power Query Editor to see the M code for your query. A typical folder-import query looks something like this:
let
Source = Folder.Files("C:\Data\MonthlySales"),
FilterExcel = Table.SelectRows(Source, each [Extension] = ".xlsx"),
AddWorkbook = Table.AddColumn(FilterExcel, "Workbook",
each Excel.Workbook([Content], true)),
ExpandWorkbook = Table.ExpandTableColumn(
AddWorkbook, "Workbook", {"Data"}, {"Data"}),
CombineData = Table.Combine(ExpandWorkbook[Data])
in
CombineData
Reading through this line by line: Folder.Files lists all files in the folder. Table.SelectRows filters to only .xlsx files, ignoring anything else in the folder. Excel.Workbook opens each file and reads its contents. Table.ExpandTableColumn pulls the actual data out of each opened workbook. Table.Combine stacks all the resulting tables on top of each other into one.
The most useful customization at this level is the filter step. If you ever want to exclude certain files by name — for example, a template file you keep in the same folder — you can add a condition to the FilterExcel step:
FilterExcel = Table.SelectRows(Source, each
[Extension] = ".xlsx" and not Text.Contains([Name], "TEMPLATE"))
This filters to .xlsx files while also excluding any file with "TEMPLATE" in its name, leaving it in the folder without it being pulled into the report.
In Practice: A Real-World Scenario
Here's how this looks in a common real-world setup. A finance team receives one Excel file per month from their accounting system — twelve files per year, each named Expenses_2026-01.xlsx, Expenses_2026-02.xlsx, and so on. Every file has the same sheet name ("Export") and the same columns: Date, Department, Category, Amount.
Before this setup, someone had to manually open Power BI every month, re-import the files, and republish. With the Folder connector, the team dropped all twelve files into a SharePoint folder, built the combination query once, and published the report to Power BI Service with a scheduled daily refresh.
Now, when month 13's file arrives, whoever receives it drops it into the SharePoint folder. The next scheduled refresh pulls it in automatically. The team's dashboards update overnight with zero manual intervention. The only ongoing requirement is that the accounting system keeps exporting files in the same format — which, since it's a system export, it always does.
Common Mistakes and How to Avoid Them
- Putting unrelated files in the same folder. The Folder connector pulls in every file matching the extension filter. A stray Excel file you dropped in for temporary reference will become part of your combined dataset if you leave it there.
- Inconsistent sheet names across files. This is the most common cause of "Expression.Error: The key didn't match any rows in the table." If January's file has a sheet called "January" and February's calls it "February," the combination will fail. Rename sheets to a consistent name before saving the files.
- Clicking "Load" instead of "Combine & Transform Data." Plain Load imports the file-list metadata, not the actual data inside the files. Always use Combine & Transform Data.
- Forgetting to set data types. Power Query sometimes guesses types correctly, but often imports dates as text and numbers as text when it isn't sure. Always manually set every column's type before closing and applying.
- Using a local folder path for cloud-published reports. Local paths only work when refreshing inside Power BI Desktop. For scheduled cloud refresh, move the folder to SharePoint or OneDrive.
- Adding transformations to the main query that should go in Transform Sample File. If you add a transformation in the main query, it runs after all files are combined. If you add it in Transform Sample File, it runs on each individual file before combining. Removing blank rows, for example, is best done in Transform Sample File so it runs file-by-file before everything gets stacked.
Recommended Next Guides & Deep Dives
Continue expanding your Power BI and Fabric architecture knowledge with these closely connected tutorials:
-
Power Query M Language for Beginners
→
Master M code syntax, let...in blocks, and custom table transformations.
-
How to Unpivot Messy Spreadsheet Data
→
Reshape incoming monthly crosstabs into clean, tall analytical tables.
-
Fuzzy Matching in Power Query
→
Reconcile inconsistent vendor and customer names across recurring monthly files.
-
Star Schema vs Snowflake Schema in Power BI
→
Structure combined monthly transactional tables into scalable fact tables.
-
How to Build a Dynamic Date Table in DAX
→
Connect imported monthly tables to a robust enterprise date dimension.
Step-by-Step Implementation Sandbox
1. Step 1: Create a Dedicated Folder & Validate Structure
Create a dedicated folder with clean paths and ensure every monthly Excel file has matching sheet names, column headers, and tabular formats.
2. Step 2: Connect via Get Data Folder Connector
In Power BI Desktop, click Get Data > Folder, browse to your path, and review the file listing preview.
3. Step 3: Select Combine & Transform Data
Click Combine > Combine & Transform Data to launch the Combine Files dialog and select the sample sheet or named Excel Table.
4. Step 4: Configure Transforms in Power Query
Promote headers, assign explicit data types (Dates, Numbers, Text), filter duplicate header or blank rows, and keep the Source.Name column.
5. Step 5: Close & Apply to Model
Rename your query meaningfully (e.g., MonthlySales) and click Close & Apply to load the consolidated dataset into your model.
6. Step 6: Test with New Monthly File
Drop a new month's Excel file into the directory, click Refresh in Power BI Desktop, and confirm the new rows automatically appear.
Frequently Asked Questions
Does every Excel file need to have the same columns in the same order?
Yes. Power Query uses the column names and structure from the sample file as the template for every other file. If a later file has a different column name or a column missing, the query will error on that file.
What happens if one file in the folder is corrupted or has a different structure?
By default, Power Query will throw an error for the whole refresh. You can enable 'Skip files with errors' in the Combine Files dialog, which tells Power Query to silently skip any file that fails to process rather than failing the entire refresh.
Can I use this with CSV files instead of Excel?
Yes. The Folder connector works with CSV, TXT, and Excel files. The Combine Files dialog will automatically detect the file type and use the appropriate connector. For CSV files, the process is actually slightly simpler since there are no sheets to select.
Can I filter so only files from a specific date range get imported?
Yes. You can add a filter step in Power Query on the Date Modified or Name column, using M functions like Date.From or Text.Contains to include only files matching certain name patterns or modification dates.
How do I handle a file that has a summary or title row above the actual headers?
In the Transform Sample File query, add a 'Remove Top Rows' step to remove the unwanted rows before the header promotion step. Whatever you do to the sample file applies automatically to every other file.
Does this work with password-protected Excel files?
No. Power Query cannot open password-protected Excel files through the Folder connector. The files need to be unprotected and accessible without a password for the combination to work.