Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

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.Docum...
  • BA_Pete's avatar
    BA_Pete
    3 years ago

     

    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