Forum Discussion
How to pass parameter values to the url in Power query
- mahoneypat4 years agoMicrosoft Employee
Looks like appid is not a column, but a table. You can add a custom column to a table that has a column called AppID and then use Json.Document(Web.Contents(..." & [AppID] & "...))
Regards,
Pat
- Krish894 years agoHelper II
- mahoneypat4 years agoMicrosoft Employee
You are seeing the error because you are trying to do this in your Source step instead of in an Table.AddColumn step. Please see the below example. It demonstrates an error on each line (the web call is not valid), but it shows the approach you should try. The key is to have a column with your AppID values as text and then concatenate those value on each row into the web call. You then expand the column of tables to combine the data for all the AppIDs.
let
Source = {2017..2021},
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "YearID"}}),
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "Custom", each Json.Document(Web.Contents("https://www.boxofficemojo.com/weekly/by-year/" & [YearID])))
in
#"Added Custom"Pat