AI-powered spreadsheet

Automate Monthly Client Data Imports with Simple Wildcard Logic

Are you tired of manually importing client data each month, especially when the file name and location change?

3 min readMicrosoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

The real problem isn't transforming data. It's that your source file changes name and your folder structure moves every month. VBA handled it with `ThisWorkbook.Path & "\Data\"`, a relative path that adapts automatically. Power Query, by default, wants absolute paths. When those paths break, your refresh fails. That is not a skill issue. It is a design gap.

The hack you mentioned, having Power Query read a table in the workbook to retrieve file paths, works, but calling it "hacky" is generous. It is workable. You store the relative folder path in a named cell, Power Query reads that cell as a parameter, then builds the file path dynamically. It gets the job done. But it adds a manual step: someone has to update that cell when the folder moves. That is exactly the kind of fragile, human-dependent process that automation is supposed to eliminate.

What you really want is a parameter that resolves itself. A function that says "I am in this workbook, so look for the data folder relative to me." Power Query can do that, via `Parameter.CurrentWorkbook()`, `Excel.CurrentWorkbook()`, or by referencing a named range, but it requires you to structure the query to accept that parameter from the start. It is not as intuitive as VBA's `ThisWorkbook.Path`, and that is a legitimate frustration. The tool claims to be modern, yet forces you to think like a workaround engineer for a basic relative path.

Here is the practical takeaway: if you control the folder structure, embed the relative path logic directly into Power Query using `Excel.CurrentWorkbook()` and a helper table. It is not elegant, but it is reliable. If you do not control the folder structure, if the parent folder moves each month, then you have two honest options. One: keep a small VBA wrapper that updates the parameter cell before refresh. Two: switch to a tool that treats relative paths as a first-class feature. AI-native spreadsheets, for example, can infer file location from context, not hardcoded strings. They do not need you to build a scaffolding of helper cells just to find the file next door. That is the direction worth exploring.

From Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

I used to use VBA for this, but that's a lot more roundabout, and I have a lot less control over the transformation.

I have no issues with transforming the actual data itself. My issue lies in the fact that it's a different file each month. Using wildcard formatting, *filehere*.xls* would always pull the correct file. This file is also stored in the same place relative to my spreadsheet each time, but the location of the spreadsheet and folders itself changes each month.

Read the original at Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community