Forum Discussion
How to add multiple rows in to get data from an external source via an API
- 2 years ago
1.) use this code for fnGetDistance (this one is significantly faster)
(start as text, end as text)=> let Source = Json.Document(Web.Contents("https://distance.geoportail.lu/webservice/" & start & ":" & end & "?format=json")), Calculated = Source[calculated] in Calculated2.) now I see the error for Output query -
Now we have two options:
a.) you have to turn off the firewall (you need to do this for every user who will use this query)b.) replace whole code for Output query with this one:
let Source = Excel.CurrentWorkbook(){[Name="t_EnteredPoints"]}[Content], FilteredRows = Table.SelectRows(Source, each not List.Contains({[startpoint], [endpoint]}, null)), Ad_Distance = Table.AddColumn(FilteredRows, "distance", each fnGetDistance([startpoint], [endpoint]), type number), ChangedType = Table.TransformColumnTypes(Ad_Distance,{{"startpoint", type text}, {"endpoint", type text}}) in ChangedTypewith this b.) option you will need to few times to click IGNORE privacy:
You're welcome. Of course you can add new start/endpoints 😉 Let me know if you have questions.
Hi,
Sorry to ask again, but I removed all the values in the table on the left and selected two new locations. Now I get an error when I click on refresh all:
Did I do something wrong ? Was I not supposed to delete the 4 locations in the initial file?
I have never worked with Power Query before, but will start a course next week.
Kind regards