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
Anonymous
Not applicable

How to load HTML table from a webpage having multiple pages

Hello,

 

I am trying to import HTML tables data from the website mentioned below. Unfortunately I am able to import only the first 15 rows from first page/table. There are 19 pages/tables which pointing to the same link. How do I loop to the next page/table and extract data within same PBI?

 

Please suggest necessary changes to the 'M' code

 

URL: https://www.coronavirus.vic.gov.au/exposure-sites

 

let
Source = Web.BrowserContents("https://www.coronavirus.vic.gov.au/exposure-sites"),
#"Extracted Table From Html" = Html.Table(Source, {{"Column1", "TABLE.rpl-search-results-table > * > TR > TH[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6), TABLE.rpl-search-results-table > * > TR > TD[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6)"}, {"Column2", "TABLE.rpl-search-results-table > * > TR > TH[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6), TABLE.rpl-search-results-table > * > TR > TD[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6)"}, {"Column3", "TABLE.rpl-search-results-table > * > TR > TH[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TH[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5), TABLE.rpl-search-results-table > * > TR > TD[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TD[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5)"}, {"Column4", "TABLE.rpl-search-results-table > * > TR > TH[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TH[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5), TABLE.rpl-search-results-table > * > TR > TD[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TD[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5)"}, {"Column5", "TABLE.rpl-search-results-table > * > TR > TH[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TH[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TH[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4), TABLE.rpl-search-results-table > * > TR > TD[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TD[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TD[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4)"}, {"Column6", "TABLE.rpl-search-results-table > * > TR > TH[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TH[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TH[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4) + TH[colspan=""2""]:not([rowspan]):nth-child(4):nth-last-child(3), TABLE.rpl-search-results-table > * > TR > TD[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TD[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TD[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4) + TD[colspan=""2""]:not([rowspan]):nth-child(4):nth-last-child(3)"}, {"Column7", "TABLE.rpl-search-results-table > * > TR > TH[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TH[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TH[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4) + TH[colspan=""2""]:not([rowspan]):nth-child(4):nth-last-child(3), TABLE.rpl-search-results-table > * > TR > TD[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TD[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TD[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4) + TD[colspan=""2""]:not([rowspan]):nth-child(4):nth-last-child(3)"}, {"Column8", "TABLE.rpl-search-results-table > * > TR > TH[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TH[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TH[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4) + TH[colspan=""2""]:not([rowspan]):nth-child(4):nth-last-child(3) + TH[colspan=""1""]:not([rowspan]):nth-child(5):nth-last-child(2), TABLE.rpl-search-results-table > * > TR > TD[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TD[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TD[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4) + TD[colspan=""2""]:not([rowspan]):nth-child(4):nth-last-child(3) + TD[colspan=""1""]:not([rowspan]):nth-child(5):nth-last-child(2)"}, {"Column9", "TABLE.rpl-search-results-table > * > TR > TH[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TH[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TH[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4) + TH[colspan=""2""]:not([rowspan]):nth-child(4):nth-last-child(3) + TH[colspan=""1""]:not([rowspan]):nth-child(5):nth-last-child(2) + TH[colspan=""2""]:not([rowspan]):nth-child(6):nth-last-child(1), TABLE.rpl-search-results-table > * > TR > TD[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TD[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TD[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4) + TD[colspan=""2""]:not([rowspan]):nth-child(4):nth-last-child(3) + TD[colspan=""1""]:not([rowspan]):nth-child(5):nth-last-child(2) + TD[colspan=""2""]:not([rowspan]):nth-child(6):nth-last-child(1)"}, {"Column10", "TABLE.rpl-search-results-table > * > TR > TH[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TH[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TH[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4) + TH[colspan=""2""]:not([rowspan]):nth-child(4):nth-last-child(3) + TH[colspan=""1""]:not([rowspan]):nth-child(5):nth-last-child(2) + TH[colspan=""2""]:not([rowspan]):nth-child(6):nth-last-child(1), TABLE.rpl-search-results-table > * > TR > TD[colspan=""2""]:not([rowspan]):nth-child(1):nth-last-child(6) + TD[colspan=""2""]:not([rowspan]):nth-child(2):nth-last-child(5) + TD[colspan=""1""]:not([rowspan]):nth-child(3):nth-last-child(4) + TD[colspan=""2""]:not([rowspan]):nth-child(4):nth-last-child(3) + TD[colspan=""1""]:not([rowspan]):nth-child(5):nth-last-child(2) + TD[colspan=""2""]:not([rowspan]):nth-child(6):nth-last-child(1)"}}, [RowSelector="TABLE.rpl-search-results-table > * > TR"]),
#"Changed Type" = Table.TransformColumnTypes(#"Extracted Table From Html",{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}, {"Column9", type text}, {"Column10", type text}})
in
#"Changed Type"

 

 

Any help would be appreciated!

 

Thanks

 

 

 

 

2 REPLIES 2
ImkeF
Super User
Super User

I would need to study the API documentation to understand the paging mechanism for this page. So please post the link to a description of this service.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Nathaniel_C
Super User
Super User

Hi @Anonymous , @ImkeF is great at m language!
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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