web scraping from multiple pages using power query

Copper Contributor

Hi All,

 

New in power query, trying to scrape data table with multi web pages. 

 

Googling but not having the matching results 

1 st website 

"https://www.chcl.mu/storage-guide/"

 

 

let
    Source = Web.Page(Web.Contents("https://www.chcl.mu/storage-guide/")),
    Data0 = Source{0}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Data0,{{"ATP", type text}, {"VESSEL", type text}, {"CODE", type text}, {"VOYAGE", type text}, {"ACTUAL TIME OF ARRIVAL", type datetime}, {"DISCHARGE COMPLETE", type datetime}})
in
    #"Changed Type"

 

 2nd Website https://www.zauba.com/import-plastic-bucket-hs-code.html 

 

let
    Source = Web.Page(Web.Contents("https://www.zauba.com/import-plastic-bucket-hs-code.html")),
    Data0 = Source{0}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Data0,{{"Date", type text}, {"HS Code", Int64.Type}, {"Description", type text}, {"Origin Country", type text}, {"Port of Discharge", type text}, {"Unit", type text}, {"Quantity", Int64.Type}, {"Value (INR)", Int64.Type}, {"Per Unit (INR)", Int64.Type}})
in
    #"Changed Type"

 

 

Trying to import  on the above  website link which has multiple pages using power query , but still struggling to have the correct code to make it work,

 

Anyone can assist 

 

thank you

 

6 Replies

@Richard072120 Not sure what you have in mind, but I could connect to both pages and loaded both tables to an Excel sheet. See attached.

 

Or are you by any chance on a Mac? Because PQ on the Mac does not support connecting to the web.

 

@Riny_van_Eekelen, what I was trying to do , using power query to import all pages of the table on an excel sheet as there are page 1 , 2 3 and so on .
Using Windows 11 and office 365.

@Richard072120 OK, then you need to create a custom function that will pick-up all the individual pages. The attached file contains such a function (very basic though), and only for the first link.

Difficult to explain since you mention to be new to PQ. The site in the link below is a good starting point to learn PQ. When you get to Chapter 18, you'll learn about custom functions.

 

@Riny_van_Eekelen, yes exactly I was looking for, but I was struggling since I am trying to learn this technique However " The site in the link below is a good starting point to learn PQ. When you get to Chapter 18, you'll learn about custom functions." I d'ont see the link , can you resend it .
Thank you for support.