I want to use Power Query to import data received from a client, where the file name changes each month. What's the easiest way to automate this?
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.
In VBA, I could find the relative position quite easily via ThisWorkbook.Path & "\Data\"
However, I don't know how to use PQ to import automatically like this, so that I'd always import the correct data simply by refreshing links. I think I've seen people set up a somewhat hacky way, where PQ first reads a table in the workbook to retrieve values, and then uses those to find the file to query. Is that the only way?
[link] [comments]
Want to read more?
Check out the full article on the original site