Forum

Web Query by Table ...
 
Notifications
Clear all

Web Query by Table Name Not Table Number

4 Posts
2 Users
0 Reactions
83 Views
(@josephrandall)
Posts: 5
Active Member
Topic starter
 

I have an issue where sometimes the table number changes in my web query.
The table is always called "table table-striped table-sortable roster"
but sometimes it appears as table 0, but mainly as table 1.

Can you use a table name in the advanced editor instead of the table number ?

 

Capture-2.JPGCapture3-1.JPGCapture4-1.JPG

 
Posted : 22/11/2020 10:49 am
Philip Treacy
(@philipt)
Posts: 1631
Member Admin
 

Hi Jospeh,

The "table table-striped table-sortable roster" is the CSS class for the table and isn't guaranteed to be unique.  The ID of an element should be unique but the website isn't using ID's to identify tables.

So, you can filter the ClassName column to only include the table with the class "table table-striped table-sortable roster" but as I said, that's not guaranteed to always pick a single table, but it does get around using Source{1}[Data]

Here's the query I used

let
Source = Web.Page(Web.Contents("https://www.eliteprospects.com/team/184/ak-bars-kazan")),
#"Filtered Rows" = Table.SelectRows(Source, each ([ClassName] = "table table-striped table-sortable roster")),
Data = #"Filtered Rows"{0}[Data]
in
Data

Regards

Phil

 
Posted : 22/11/2020 9:32 pm
(@josephrandall)
Posts: 5
Active Member
Topic starter
 

Thank you sir !

much appreciated.

 
Posted : 23/11/2020 6:46 am
Philip Treacy
(@philipt)
Posts: 1631
Member Admin
 

no worries 🙂

 
Posted : 24/11/2020 10:42 pm
Share: