SOLVED

Download two tables from web in one function query

Copper Contributor

Hello, I wanted to ask if it's possible to download two tables from a list of URLs in one single query?

Please refer to the attached file. I have a list of URLs for different stock codes. At the moment I've set up two queries to download two separate tables from the same web page.

I was wondering besides using Append Queries, is there any way to set up just one single function query in the beginning to capture both tables in one go?

Any help and insight is much appreciated.

Thank you!

 

7 Replies
best response confirmed by nes_k4 (Copper Contributor)
Solution

@nes_k4 Change the applied step in fxOther where you initially filter one table to this:

#"Filtered Rows" = Table.SelectRows(Source, each ([Id] = "cnhk-list" or [Id] = "cnhk-list2")),

 Now the function will load both tables and create one bigger table.

Thank you so much for your help again!
I got another question please. I want to download the same data tables but in a different language. Below is the link to the site (basically the same website but in a different language):
http://www.aastocks.com/tc/stocks/analysis/company-fundamental/profit-loss?symbol=00001
I used the same queries but the download time is very slow. It took more than 2 hours, whereas the English version only took 10-15 min.
I was wondering if there're any technical issues relating to this?
Thanks again for your help!

@nes_k4 That I don't really know. Sorry!

No problem, might have been just network issues :)
Thanks again for your help!

@Riny_van_Eekelencould I please ask another question?

I want to download tables "Regular advisers" and "One-time advisers" in one query from the below website:

https://webb-site.com/dbpub/advisers.asp?p=488

How should I amend the below codes that are currently picking up "Regular advisers" only?

 

let
Source = Web.Page(Web.Contents("https://webb-site.com/dbpub/advisers.asp?p=488")),
Data0 = Source{0}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Data0, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Adviser", type text}, {"Role", type text}, {"Added", type date}, {"Removed", type date}})
in
#"Changed Type"

 

Thank you so much for your help!

@nes_k4 When you connect to that URL, it show three tables "Document", "One-time advisers" and "Regular advisers". Tick the "Select multiple items" box. Now select the two tables (see picture) you want and press transform. You'll end up with two queries that you can transform a bit and then append into one new query. If that's what you need, of course, like in the attached file.

Screenshot 2021-12-05 at 06.44.08.png

 

@Riny_van_Eekelenthis is great, thank you very much!

1 best response

Accepted Solutions
best response confirmed by nes_k4 (Copper Contributor)
Solution

@nes_k4 Change the applied step in fxOther where you initially filter one table to this:

#"Filtered Rows" = Table.SelectRows(Source, each ([Id] = "cnhk-list" or [Id] = "cnhk-list2")),

 Now the function will load both tables and create one bigger table.

View solution in original post