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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
BFG_GFB
New Member

Extracting table/data from Website

Can anyone help me extract the data from the tabel in the following website ?
TGJ23.F - Dutch TTF Gas Apr 2023 - Stooq

1 REPLY 1
ppm1
Solution Sage
Solution Sage

Here's one way to do it in the query editor.  To see how it works, just create a blank query, open the Advanced Editor and replace the text there with the M code below.

let
    Source = Web.BrowserContents("https://stooq.com/q/d/?s=tgj23.f&i=d&l=1"),
    #"Extracted Table From Html" = Html.Table(Source, {{"Column1", "TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(9), TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(10)"}, {"Column2", "TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(8), TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(10) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(9)"}, {"Column3", "TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(7), TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(10) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(8)"}, {"Column4", "TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(6), TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(10) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(7)"}, {"Column5", "TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(6) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(5), TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(10) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(6)"}, {"Column6", "TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(6) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(5) + TD:not([colspan]):not([rowspan]):nth-child(6):nth-last-child(4), TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(10) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(6) + TD:not([colspan]):not([rowspan]):nth-child(6):nth-last-child(5)"}, {"Column7", "TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(6) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(5) + TD:not([colspan]):not([rowspan]):nth-child(6):nth-last-child(4) + TD[colspan=""2""]:not([rowspan]):nth-child(7):nth-last-child(3), TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(10) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(6) + TD:not([colspan]):not([rowspan]):nth-child(6):nth-last-child(5) + TD:not([colspan]):not([rowspan]):nth-child(7):nth-last-child(4)"}, {"Column8", "TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(6) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(5) + TD:not([colspan]):not([rowspan]):nth-child(6):nth-last-child(4) + TD[colspan=""2""]:not([rowspan]):nth-child(7):nth-last-child(3), TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(10) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(6) + TD:not([colspan]):not([rowspan]):nth-child(6):nth-last-child(5) + TD:not([colspan]):not([rowspan]):nth-child(7):nth-last-child(4) + TD:not([colspan]):not([rowspan]):nth-child(8):nth-last-child(3)"}, {"Column9", "TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(6) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(5) + TD:not([colspan]):not([rowspan]):nth-child(6):nth-last-child(4) + TD[colspan=""2""]:not([rowspan]):nth-child(7):nth-last-child(3) + TD:not([colspan]):not([rowspan]):nth-child(8):nth-last-child(2), TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(10) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(6) + TD:not([colspan]):not([rowspan]):nth-child(6):nth-last-child(5) + TD:not([colspan]):not([rowspan]):nth-child(7):nth-last-child(4) + TD:not([colspan]):not([rowspan]):nth-child(8):nth-last-child(3) + TD:not([colspan]):not([rowspan]):nth-child(9):nth-last-child(2)"}, {"Column10", "TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(6) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(5) + TD:not([colspan]):not([rowspan]):nth-child(6):nth-last-child(4) + TD[colspan=""2""]:not([rowspan]):nth-child(7):nth-last-child(3) + TD:not([colspan]):not([rowspan]):nth-child(8):nth-last-child(2) + TD:not([colspan]):not([rowspan]):nth-child(9):nth-last-child(1), TABLE[id='fth1'] > * > TR > TD:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(10) + TD:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(9) + TD:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(8) + TD:not([colspan]):not([rowspan]):nth-child(4):nth-last-child(7) + TD:not([colspan]):not([rowspan]):nth-child(5):nth-last-child(6) + TD:not([colspan]):not([rowspan]):nth-child(6):nth-last-child(5) + TD:not([colspan]):not([rowspan]):nth-child(7):nth-last-child(4) + TD:not([colspan]):not([rowspan]):nth-child(8):nth-last-child(3) + TD:not([colspan]):not([rowspan]):nth-child(9):nth-last-child(2) + TD:not([colspan]):not([rowspan]):nth-child(10):nth-last-child(1)"}}, [RowSelector="TABLE[id='fth1'] > * > TR"]),
    #"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"No.", Int64.Type}, {"Date", type date}, {"Open", type number}, {"High", type number}, {"Low", type number}, {"Close", type number}, {"Change", Percentage.Type}, {"Change_1", type number}, {"Volume", Int64.Type}, {"Open Interest", Int64.Type}})
in
    #"Changed Type"

 

Pat

 

Microsoft Employee

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.