Nov 15 2022 12:06 AM
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
Nov 15 2022 02:11 AM
@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.
Nov 15 2022 02:21 AM
Nov 15 2022 02:50 AM
@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.
Nov 15 2022 03:09 AM
Nov 15 2022 03:12 AM
@Richard072120 Sorry about that! Here it is.
Nov 15 2022 03:19 AM