Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello I am trying to do a nested API call using M language.
Step 1) The Code makes a call List of links.
Step 2) The links are in csv format.
Step 3) Each link turns into a table
Step 4) Want to merge all the tables into one big table?
Source = scenarios,
#"Changed Type1"=Table.SelectColumns(Source,"Scenario_API_URL"),
#"Changed Type0"= Table.FromRecords({[API_URL = Table.SelectColumns(#"Changed Type1","Scenario_API_URL")]}),
#"Expanded API_URL" = Table.ExpandTableColumn(#"Changed Type0", "API_URL", {"Scenario_API_URL"}, {"API_URL.Scenario_API_URL"}),
#"scenario count"=Table.RowCount(#"Expanded API_URL"),
Generating List using the CSV data
#"New List" =
List.Generate(()=> [ NewTable={},x = 1 , y = {}] , each [x] < #"scenario count" , each [
test = Csv.Document(Web.Contents( #"Expanded API_URL"{x}[API_URL.Scenario_API_URL] ,[Headers=[Authorization="Token token=""API TOKEN"""]]),[Delimiter=",", Columns=30, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Converted to Table" = Table.FromList(test, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
x = [x] + 1
] ,
each [ test]
),
//Promote Header for each table From #"New List"
#"New List2" =
List.Generate(()=> [ x = 1 , y = {}] , each [x] < #"scenario count" , each [y = {Table.PromoteHeaders(#"New List"{x}, [PromoteAllScalars=true])},x=[x]+1] , each [y]),
// Now I just want to combine all the tables In to one big table.
#"New List3" =
List.Generate(()=> [ x = 1, k = {} , #"myEmptyTable" = #table({"Email"})] , each [x] < #"scenario count" , each [#"ResultSet"=Table.Combine({#"New List2"{x}}),x=[x]+1] , each [#"ResultSet"])
in
#"New List3"
The tables does have different numbers of column and rows. My question is I get "Forbidden Access" when I try to combine the tables into one table.
Hi @Anonymous ,
Please check if the access token is legal. If it is legal, please check if it has expired.
Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
96 | |
77 | |
63 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |