cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tomshaw83
Helper I
Helper I

Scraping Table Data

Hello,


I am trying to pull some information on the swimming at the 2008 Summer Olympics from wikipedia

 

https://en.wikipedia.org/wiki/Swimming_at_the_2008_Summer_Olympics_%E2%80%93_Men%27s_50_metre_freest... 

 

The event information is structured in a consistent format eg:-

Men%27s_50_metre_freestyle 

Men%27s_100_metre_freestyle 

Men%27s_200_metre_freestyle 

Men%27s_400_metre_freestyle

 

So i have produced a function to scrape each page. When connecting to the intial page I selected the 'Heats' table,  believing that this would identify the table to connect to for all the subsequent pages.

 

tomshaw83_1-1621074273731.png

 

 

When looking at the source this isn’t the case, it seems to have stored the original table using its position on the page. This means that the data doesn’t pull through on the majority of tables, as the table doesn’t fall in the same place on the page as the original.

 

Is there any way I can direct the original query to the Heats table, such that if finds the Heats table on all the other pages? Anything I’ve written in the advanced editor so far fails! Also if there are any online resources on this particular problem I would really like to look into them, everything I have viewed on youtube only concerns connecting to different pages, and not how to connect to specific tables within those different pages.


Thanks


Tom

4 REPLIES 4
lbendlin
Super User III
Super User III

I'd recommend you learn about the HTML DOM

 

JavaScript DOM Methods (w3schools.com)

Thanks, will look through this

lbendlin
Super User III
Super User III

Have you considered parsing the HTML instead? The Heats section seems to be identifiable by the span id.

 

lbendlin_0-1621131657853.png

 

Thank you for the response, do you know of any good online resources I could use to upskill on this? I'm at the edge of my understanding so need to learn more before I can attempt anything more complexed

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors