Power Query can reuse the same transformation steps every day while selecting a new source file. For a daily work-items report, the most reliable setup is a folder connection that keeps the newest file and ignores older files. This avoids rebuilding the query or replacing files manually.
The problem
This came up in the r/excel community from someone downloading a daily report, transforming it in Power Query, and needing the workbook to use the next file without losing previous downloads. The core issue affects businesses that receive recurring inventory lists, sales reports, work queues, or operational exports in the same structure.
The goal is not to create a new query for every download. It is to separate the file import from the transformation steps. The import query identifies the correct file. The transformation query cleans and reshapes its contents. Once those query steps exist, a refresh applies them again to the next report.
The most practical approach is to store every daily report in one folder. The folder connection can select the newest file based on its Date modified value, so older files remain available for history or audit purposes. The original discussion is available in the r/excel question about updating a Power Query source file.
The solution
Use a two-part Power Query design:
- A source query connects to the folder and identifies the file to import.
- A transformation query applies the cleaning steps to the selected file.
This is usually better than a macro for the data preparation itself. Power Query records repeatable data transformation steps, such as removing columns, changing data types, filtering rows, splitting text, and combining tables. A macro can provide a file-picker button, but it adds code that must be maintained and secured.
For a daily report, the source query should:
- Connect to the folder where reports are saved.
- Sort files by Date modified in descending order.
- Keep the top row.
- Open the selected file.
- Pass its contents to the transformation steps.
The "keep the top row" step means Power Query retains only the newest file after sorting. Each day, the operator saves the new report in the folder and refreshes the workbook. The older reports remain untouched.
A consistent naming convention is still useful. Names such as WorkItems_2026-10-16.xlsx make the folder easier to audit and allow additional filters by file name. However, renaming is not required when the newest file is always the correct source.
A second option is a workbook-controlled file parameter. The operator can type a full file path into a cell, load that cell into Power Query, and use it as the source. This gives direct file selection without opening the Power Query editor. It is useful when the correct file is not always the newest one.
The folder method is more robust for a standard daily workflow. The cell parameter is better when an operator must choose among several reports or rerun an older date.
How to apply it
Create a dedicated folder for the daily reports. Do not mix unrelated Excel or CSV files into it.
Save each downloaded report in that folder. Keep the column names, table structure, and worksheet layout consistent.
In Excel, open the Data tab and choose Get Data, then From File, then From Folder.
Select the report folder. In the file preview, choose Transform Data rather than loading every file immediately.
In Power Query, filter the file list if necessary. For example, filter the Name column so that only files containing
WorkItemsremain.Sort the Date modified column from newest to oldest.
Select Keep Rows, then Keep Top Rows, and enter
1. This leaves only the newest matching file.Use the file's binary content to open the workbook or CSV. For an Excel report, select the appropriate worksheet or table.
Apply the data transformation steps once. Typical steps include promoting headers, removing blank rows, changing dates and quantities to the correct data types, and filtering out totals or notes.
Give the queries clear names, such as
Source_LatestWorkItemsandTransform_WorkItems. Clear names make the workbook easier to maintain.Load the transformed result into a worksheet or the Data Model, depending on how the report will be used.
Test the workflow. Add a second report with a newer modified date, refresh the query, and confirm that the result changes to the new file.
Configure refresh behavior from Data, Queries & Connections, and the query properties. The source discussion recommends updating the query when the workbook opens, where that option is available in the Excel setup.
Document the folder location and file rules in a small instruction sheet. State that the report must use the same columns and that unrelated files should not be saved there.
The file structure matters more than the file name. If a new report changes a column heading, removes a table, or changes a date format, a previously working query can fail. Keep the report schema stable, or add validation steps that flag missing columns before the output reaches the business report.
If selecting a specific file is more important than selecting the newest file, create a small Excel table with one value containing the full file path. Import that table into Power Query, extract the path value, and use it as a parameter in the source step. The operator can then change the path in the worksheet and refresh the workbook. This alternative is more controlled, but it introduces a manual input that can contain typing errors.
Implementation angle
For a small business, this pattern can become a controlled reporting workflow instead of a personal Excel routine. Creator Scripts can connect the daily folder to a structured process in Zoho Creator, or use Make or n8n to place incoming reports in the correct folder and trigger the refresh workflow. A validation layer can check that required columns such as item ID, status, quantity, and date exist before the report is loaded. For teams looking to move beyond spreadsheet-based reporting entirely, Zoho Analytics offers business intelligence dashboards that can connect directly to data sources without manual file handling. Claude can also help document the query steps, review M Code, and identify why a new report no longer matches the expected structure.
Book an AI implementation engagement with Creator Scripts at creatorscripts.com.
Frequently asked questions
How do I set up Power Query to automatically use the latest file from a folder?
Create a source query in Power Query that connects to the folder where your reports are saved. Sort the files by their date modified, keep the top row, and then apply your transformation steps to the data from that file.
Can I use Power Query without constantly changing the source file?
Yes, you can use a folder connection to identify and pull in the newest file automatically each day. This way, you only need to refresh the queries without manually changing the source file every time.
What if my reports have different formats each day?
If the report structure changes, it can cause your query to fail. It's essential to maintain a consistent schema in your reports or implement validation steps to check for required columns before loading the data.