Dynamic date in Power query source link

sitewolf

Active Member
Joined
May 4, 2012
Messages
307
Haven't been here in awhile....not sure that's a good thing or a bad...

I am using a power query to access/manipulate data from a web link. Within that link is a date. I'd like to create a source link that updates with the necessary date. I already have that date dynamically updating as I need in a cell of the workbook (i.e. it displays yesterday's date until 8am before changing to today's date...not really relevant to the question).

1) How do I pull the date from that cell to be a part of the link? (I've named the cell already)
2) Once I'm pulling that date into the link, how would I also format that date (it needs to be yyyy-mm-dd in the link)

The relevant part of the link is dateFrom=2025-03-08&dateTo=2025-03-08
If I didn't need this date updated in multiple queries, it wouldn't be horrible to just edit, but there'd generally be about a dozen
 
You need to build a parameter query. Add the date with a header as a separate table. Then where the date is hardcoded in your source line, replace it with the parameter table name.
 
Last edited:
Upvote 0
I appreciate the response, but I guess I'm not quite figuring out the how there. A Microsoft page says 'from an existing query, convert to a parameter' but I'm not quite following how to turn a cell with a formula in it into a query TO convert to a parameter.
 
Upvote 0
What is the URL of the web site you would like to retrieve data from? Once I have that I hope that I can give you a demo of how to make it work. In the meantime, here is a tutorial on Parameters and PQ. the same principle applies to getting the date into the web source in your query.

 
Upvote 0
example would be...https://www.nhl.com/stats/goalies?reportType=game&dateFrom=2025-03-08&dateTo=2025-03-08&gameType=2&sort=wins,savePct&page=0&pageSize=100
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top