Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hey,
In future, I need to combine 2 web contents in ONE table - one for historical data and after a website relaunch for the "new" data.
currently, the expression is like this:
= Json.Document(Web.Contents("https://www.thisisaplaceholderurl12345.com/"))
How can i add a second URL? Ideally as Power Query M...
because: I already tried via Get Data/Web/Advanced/URL parts --> but this didn't work out.
Thanks & Regards, Steph
Solved! Go to Solution.
Just follow the same pattern as before, something like this:
let
Source1 = Json.Document(Web.Contents("https://www.jsonkeeper.com/12345")),
convToTable1 = Table.FromList(Source1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Source2 = Json.Document(Web.Contents("https://www.thisisafunnyurl.com")),
convToTable2 = Table.FromList(Source2, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
combineQueries = Table.Combine({convToTable1, convToTable2})
in
combineQueries
If you're feeling particularly brave, you can combine the code into single steps for each source:
let
Source1 =
Table.FromList(
Json.Document(Web.Contents("https://www.jsonkeeper.com/12345")),
Splitter.SplitByNothing(),
null,
null,
ExtraValues.Error
),
Source2 =
Table.FromList(
Json.Document(Web.Contents("https://www.thisisafunnyurl.com")),
Splitter.SplitByNothing(),
null,
null,
ExtraValues.Error
),
combineQueries = Table.Combine({Source1, Source2})
in
combineQueries
Pete
Proud to be a Datanaut!
Hi Pete,
thanks for your answer!
I tried Option 2, but I'm not sure, if I got you right:
Does it have to look like this?
Source = Table.Combine(Json.Document(Web.Contents("https://www.thisisafunnyurl.com")), Json.Document(Web.Contents("https://www.jsonkeeper.com/12345"))).
Steph
Hi Steph,
No, Query1 would be like this:
let
Source = Json.Document(Web.Contents("https://www.thisisafunnyurl.com"))
in
Source
Query2 would be like this:
let
Source = Json.Document(Web.Contents("https://www.jsonkeeper.com/12345"))
in
Source
And you'd have a new Query3 like this:
let
Source = Table.Combine({Query1, Query2})
in
Source
You could reference one of the queries from within the other but, at that point, you may as well go for Option 1, which would look like this:
let
Source1 = Json.Document(Web.Contents("https://www.jsonkeeper.com/12345")),
Source2 = Json.Document(Web.Contents("https://www.thisisafunnyurl.com")),
combineQueries = Table.Combine({Source1, Source2})
in
combineQueries
Pete
Proud to be a Datanaut!
Seems as if it's going to work...
BUT: This error occurred:
I found a convert-to-table command in another of my (inherited) tables... but how do i adjust the command when dealing with 2 sources now?
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Just follow the same pattern as before, something like this:
let
Source1 = Json.Document(Web.Contents("https://www.jsonkeeper.com/12345")),
convToTable1 = Table.FromList(Source1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Source2 = Json.Document(Web.Contents("https://www.thisisafunnyurl.com")),
convToTable2 = Table.FromList(Source2, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
combineQueries = Table.Combine({convToTable1, convToTable2})
in
combineQueries
If you're feeling particularly brave, you can combine the code into single steps for each source:
let
Source1 =
Table.FromList(
Json.Document(Web.Contents("https://www.jsonkeeper.com/12345")),
Splitter.SplitByNothing(),
null,
null,
ExtraValues.Error
),
Source2 =
Table.FromList(
Json.Document(Web.Contents("https://www.thisisafunnyurl.com")),
Splitter.SplitByNothing(),
null,
null,
ExtraValues.Error
),
combineQueries = Table.Combine({Source1, Source2})
in
combineQueries
Pete
Proud to be a Datanaut!
Hi Steph,
Two options:
-1- Duplicate your original source line in Advanced Editor. Rename the original Source step to Source1, and the new one to Source2. Amend the URL in Source2 to point to the new endpoint. You now have both sources loading into the same query that can be individually referenced, such as Table.Combine({Source1, Source2}) if you want to append them, and so on.
-2- Duplicate your original query and adjust the URL in the second one to the new endpoint. Same usage as above, but now you will just reference query names instead of step names, such as Table.Combine({oldQuery, newQuery}).
Pete
Proud to be a Datanaut!