Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
Trying to get distance between 2 points, either Zipcodes or Latitude/Logitude. Got the API key for Google Distance matrix API. Works fine when I manually try. But I have an Excel file in which I have columns with Zip codes for from and To and I want to iteratively go thru that list and get the distance and add in a new column. Either in excel or on Power Query.
For e,g, I tried below in a browser and got the distance.
https://maps.googleapis.com/maps/api/distancematrix/json
?destinations=22434
&origins=23173
&units=imperial
&key= XXXX
Anyone has any ideas ? A step by step guide will be very helpful.
Thanks in advance.
Ann
Solved! Go to Solution.
@pbi_user2024
Hi try the below.
=Json.Document(Web.Contents("https://maps.googleapis.com/maps/api/distancematrix/json?origins=" & Text.From([FromZip]) & "&destinations=" & Text.From([ToZip]) & "&units=imperial&key=YOUR_API_KEY"))[rows]{0}[elements]{0}[distance][text]
@pbi_user2024
Hi try the below.
=Json.Document(Web.Contents("https://maps.googleapis.com/maps/api/distancematrix/json?origins=" & Text.From([FromZip]) & "&destinations=" & Text.From([ToZip]) & "&units=imperial&key=YOUR_API_KEY"))[rows]{0}[elements]{0}[distance][text]
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!