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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
wdvro
Frequent Visitor

Importing multiple pages tabular data from web

Hello all,

 

In Power BI, I want to import data concerning arrivals of cruiseships. This data has been made publicly available on a website (see below), displayed in a table.

However, the data in the table is divided over several webpages (about 30), each showing 10 lines of data:

https://www.portofantwerpbruges.com/scheepvaart/cruises/aankomst-en-vertrek-van-cruises-zeebrugge?pa...

https://www.portofantwerpbruges.com/scheepvaart/cruises/aankomst-en-vertrek-van-cruises-zeebrugge?pa...

https://www.portofantwerpbruges.com/scheepvaart/cruises/aankomst-en-vertrek-van-cruises-zeebrugge?pa...

... and so on.

 

How can I import the data? 

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

Here is a (very) pedestrian approach.  This will not work in a Power BI Service refresh scenario though. Some pages seem to be missing, too.

 

let
    #"Table 1" = {1..30},
    #"Converted to Table" = Table.FromList(#"Table 1", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Page"}}),
    #"Invoked Custom Function" = Table.AddColumn(#"Renamed Columns", "getpage", each getpage([Page])),
    #"Expanded getpage" = Table.ExpandTableColumn(#"Invoked Custom Function", "getpage", {"Aankomst", "Vertrek", "Schip", "Rederij", "Website", "Lengte", "Vlag"})
in
    #"Expanded getpage"

 

here is the getpage function:

(p) => let
        Source = Web.BrowserContents("https://www.portofantwerpbruges.com/scheepvaart/cruises/aankomst-en-vertrek-van-cruises-zeebrugge?page=" & Text.From(p)),
        #"Extracted Table From Html" = Html.Table(Source, {{"Column1", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(1)"}, {"Column2", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(2)"}, {"Column3", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(3)"}, {"Column4", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(4)"}, {"Column5", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(5)"}, {"Column6", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(6)"}, {"Column7", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(7)"}}, [RowSelector="TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR"]),
        #"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]),
        #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Aankomst", type datetime}, {"Vertrek", type datetime}},"nl")
    in
        #"Changed Type"

 

lbendlin_0-1717442823795.png

 

 

 

View solution in original post

wdvro
Frequent Visitor

Thanks, that worked! 

View solution in original post

2 REPLIES 2
wdvro
Frequent Visitor

Thanks, that worked! 

lbendlin
Super User
Super User

Here is a (very) pedestrian approach.  This will not work in a Power BI Service refresh scenario though. Some pages seem to be missing, too.

 

let
    #"Table 1" = {1..30},
    #"Converted to Table" = Table.FromList(#"Table 1", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Page"}}),
    #"Invoked Custom Function" = Table.AddColumn(#"Renamed Columns", "getpage", each getpage([Page])),
    #"Expanded getpage" = Table.ExpandTableColumn(#"Invoked Custom Function", "getpage", {"Aankomst", "Vertrek", "Schip", "Rederij", "Website", "Lengte", "Vlag"})
in
    #"Expanded getpage"

 

here is the getpage function:

(p) => let
        Source = Web.BrowserContents("https://www.portofantwerpbruges.com/scheepvaart/cruises/aankomst-en-vertrek-van-cruises-zeebrugge?page=" & Text.From(p)),
        #"Extracted Table From Html" = Html.Table(Source, {{"Column1", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(1)"}, {"Column2", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(2)"}, {"Column3", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(3)"}, {"Column4", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(4)"}, {"Column5", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(5)"}, {"Column6", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(6)"}, {"Column7", "TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR > :nth-child(7)"}}, [RowSelector="TABLE.lg\:w-full.table-auto.\[\&_td\]\:border-none.\[\&_th\]\:border-none > * > TR"]),
        #"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]),
        #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Aankomst", type datetime}, {"Vertrek", type datetime}},"nl")
    in
        #"Changed Type"

 

lbendlin_0-1717442823795.png

 

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.