Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Super User

I'd recommend you learn about the HTML DOM

 

JavaScript DOM Methods (w3schools.com)

Thanks, will look through this

lbendlin
Super User
Super User

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors