Created
November 19, 2019 18:17
-
-
Save sktse/77e0c8126542f4bd8d7f9455128bc5f4 to your computer and use it in GitHub Desktop.
Google Sheets script to Google Geo encode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getGoogleAddress(placeId) { | |
var API_KEY = ''; | |
var baseUrl = 'https://maps.googleapis.com/maps/api/geocode/json'; | |
var queryUrl = baseUrl + '?key=' + API_KEY + '&place_id=' + placeId; | |
Logger.log(queryUrl); | |
var response = UrlFetchApp.fetch(queryUrl); | |
var json = response.getContentText(); | |
var result = JSON.parse(json).results[0]; | |
var placeId = result.formatted_address; | |
return placeId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment