Dynamic Power Query (web)

Abdmujib

Board Regular
Joined
May 15, 2022
Messages
123
Office Version
  1. 2021
Platform
  1. Windows
I want to use power query to extract a table from the web.

In the picture below, I loaded a table from this website Premier League Form Table
there are multiple websites that has the same table structure and with the same table position, that I will love to switch to without having to go to power query, maybe by pasting the website in the cell B2 and then the table for the particular link load.


1694328888118.jpeg


so, I paste the link for spain in Cell B2 , the table loads for , spain without having to go to power query to put spain link into it.

pls kindly help. thanks
 
I have gotten the RLink thank you so much. I didn't changed the name of the query to "Functiongetnamedquery" that was where the mistakes comes from
Start with this for the results part (RLink1 > BC5).
It is almost straight off the link below:
  1. Create a new Blank Query and copy in the first lot of code below and call the query >
    functionGetNamedRange
  2. Create a second blank query and copy in the 2nd lot of code below, give it a meaningful name and then close and load it with a destination of BC5
  3. See how the results look and come back to me on what works and what doesn't and what we need to change.


1) functionGetNamedRange

Power Query:
let GetNamedRange=(NamedRange) =>
 
let
    name = Excel.CurrentWorkbook(){[Name=NamedRange]}[Content],
    value = name{0}[Column1]
in
    value

in GetNamedRange

2) Report

Power Query:
let
    Source = Web.Page(Web.Contents(functionGetNamedRange("RLink1"))),
    Data0 = Source{0}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Data0,{{"Semi-finals - 3rd leg", type text}, {"Semi-finals - 3rd leg2", type text}, {"1", Int64.Type}, {"2", Int64.Type}, {"", type date}})
in
    #"Changed Type"

Link
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Great. We're you ok with duplicating the RLink query and just changing the range name to Fixtures1 and then loading it to the other output cell.
 
Upvote 0

Forum statistics

Threads
1,223,967
Messages
6,175,672
Members
452,666
Latest member
AllexDee

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