Forum Discussion
Anonymous
5 years agoNot 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
- ImkeFCommunity Champion
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.
- Nathaniel_CCommunity Champion
Hi Anonymous , ImkeF is great at m language!
Nathaniel