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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
I am trying to populate latitude and longitude against a list of pincodes in excel. Trying with below code but giving error.
latlong is the name of table
pincode is the name of table header
let
Source = Excel.CurrentWorkbook(){[Name="latlong"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"pincode", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Json.Document(Web.Contents("https://nominatim.openstreetmap.org/search?format=json&q=" & Text.From([pincode])))),
#"Expanded Custom" = Table.ExpandRecordColumn(#"Added Custom", "Custom", {"lat", "lon"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"lat", type number}, {"lon", type number}})
in
#"Changed Type1"
Hello @Praveen806,
Can you please try this approach:
let
Source = Excel.CurrentWorkbook(){[Name="latlong"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"pincode", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each
let
SourceJson = Json.Document(Web.Contents("https://nominatim.openstreetmap.org/search?format=json&q=" & [pincode])),
FirstResult = if List.Count(SourceJson) > 0 then SourceJson{0} else null,
Latitude = if FirstResult <> null then FirstResult[lat] else null,
Longitude = if FirstResult <> null then FirstResult[lon] else null
in
[lat = Latitude, lon = Longitude]
),
#"Expanded Custom" = Table.ExpandRecordColumn(#"Added Custom", "Custom", {"lat", "lon"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"lat", type number}, {"lon", type number}})
in
#"Changed Type1"
Let me know if you might require any further assistance.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 14 | |
| 12 | |
| 12 | |
| 7 | |
| 6 |