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

How to dynamically change folder path in Power Query each month?

Our take

If you're an accountant managing month-end reports, you know how tedious it can be to manually update the folder path in Power Query each month. This process can disrupt your workflow and consume valuable time. Fortunately, there’s a way to dynamically change the folder path to reflect the current month automatically. By leveraging Power Query's M code, you can simplify this task, allowing it to detect the current month’s folder without manual intervention.

Hi, I’ve been struggling with this for hours. Copilot and Gemini keep giving me code that doesn’t work.

I’m an accountant, and during month-end close I usually compile several reports and paste them into a folder. Then I run a simple Power Query that reads, transforms, and filters the data into a final table.

It works perfectly.

The issue is that every month I copy and paste the files into a new folder, and I have to manually edit the directory path in Power Query — for example:

C:\Users\wakiarg\THE COMPANY\THE SHAREPOINT - Documents\2026\2026-01\

Then I change it to 2026-02, 2026-03, and so on.

Is there a simple way to modify the M code so Power Query automatically detects the current month folder (e.g., -02, -03, etc.) instead of me having to manually update the path each time?

The IA gave me some ideas using =cell but it's giving me an URL instead of the local directory, and from there on its a mess.

Ideally, I’d like it to dynamically reference where the file is stored, as the folder is always there.

submitted by /u/wakiarg
[link] [comments]

Read on the original site

Open the publisher's page for the full experience

View original article

Related Articles

Tagged with

#Excel alternatives for data analysis#generative AI for data analysis#natural language processing for spreadsheets#real-time data collaboration#no-code spreadsheet solutions#rows.com#big data management in spreadsheets#conversational data analysis#Excel compatibility#financial modeling with spreadsheets#intelligent data visualization#real-time collaboration#data visualization tools#enterprise data management#big data performance#Excel alternatives#data analysis tools#data cleaning solutions#Power Query#folder path