Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Importing a csv with dynamic url from a webpage



I'd like to set up a query that automatically extracts the most recent versions of these csv documents from the below webpages. The csvs change each week and I need the report to work with scheduled refresh.


I have previously set up a query to import a csv/xlxs using a dynamic date, but I wonder if there is a better way to do this? The NHS files in particular are tricky as other parts of the url string change randomly each week rather than just the date.


Can anyone advise if there is an easy way to achieve this? Thanks  (csv files are in the Resources section towards the bottom of the page)

Super User III
Super User III

Here's one way of approaching this


    Source = Date.WeekOfYear(DateTime.FixedLocalNow()),
    Weeks = {Source-30..Source},
    #"Converted to Table" = Table.FromList(Weeks, Splitter.SplitByNothing(),  {"Week"},null, ExtraValues.Error),
    #"Added Custom" = Table.AddColumn(#"Converted to Table", "URL", each try Excel.Workbook(Web.Contents("" & Text.From([Week]) & ".xlsx")) otherwise null)
    #"Added Custom"

Helpful resources



We are excited to announce the Power BI Super Users!

Wave Release 2

Check out the updates in Power BI.

Overview of Power BI 2020 release wave 2!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!


The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors