cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jmillsjmills
Frequent Visitor

Web Scraping - CSS Selectors and Attributes

Hello,

 

I am hoping one of you kind forum folk can help me. I can't say I know too much about coding, but I feel like I am close! Essentially, I would like "Column1" to return the numeric value of the "data-event-id" attribute - so the first row should be 2710602.

 

At the moment my code says {"Column1", ".event", each[Attributes][href]} for populating that first column... But when I switch it to {"Column1", ".event", each[Attributes][data-event-id]} it returns an error that it cannot even define.

 

Am deliberately using the new Power BI desktop feature which can handle non-HTML tables and convert them. I know the rest of the script works: in other columns, I can already pull back text strings like 12.00PM, Jahn Regensburg and Darmstadt 98 in the above code with the respective CSS selectors: .time, .team1 and .team2.

 

As I say, just need to find a means of pulling back the ID string held within the "data-event-id" attribute, but I can't quite get there. Was also trying to use this tutorial (hence originally having [href] in the above).

 

0tovyn3xw5351.pnga0zaszd8w5351.png

1 ACCEPTED SOLUTION
mwegener
Super User II
Super User II

Hi @jmillsjmills ,

 

use this.

{"Column1", ".event", each [Attributes][#"data-event-id"]}

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #
"Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website


View solution in original post

4 REPLIES 4
V-lianl-msft
Community Support
Community Support

Hi @jmillsjmills ,

 

You can also refer to this:https://ssbipolar.com/2018/10/27/web-scraping-with-html-table-in-power-query/ 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you!

mwegener
Super User II
Super User II

Hi @jmillsjmills ,

 

use this.

{"Column1", ".event", each [Attributes][#"data-event-id"]}

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #
"Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website


View solution in original post

That is fantastic - thank you so much!

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors