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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.