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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
SteWo
Frequent Visitor

Web.Contents with more than one URL

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

 

 

1 ACCEPTED 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



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

5 REPLIES 5
SteWo
Frequent Visitor

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"))).

 

SteWo_0-1684936266228.png

 

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



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




SteWo
Frequent Visitor

Seems as if it's going to work...

 

BUT: This error occurred:

 

SteWo_0-1684941737301.png

 

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



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




BA_Pete
Super User
Super User

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



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors