Skip to content

Instantly share code, notes, and snippets.

@sktse
Created November 19, 2019 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sktse/77e0c8126542f4bd8d7f9455128bc5f4 to your computer and use it in GitHub Desktop.
Save sktse/77e0c8126542f4bd8d7f9455128bc5f4 to your computer and use it in GitHub Desktop.
Google Sheets script to Google Geo encode
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