Skip to content

Instantly share code, notes, and snippets.

@gr33ndata
Created December 27, 2013 01:25
Show Gist options
  • Save gr33ndata/8141155 to your computer and use it in GitHub Desktop.
Save gr33ndata/8141155 to your computer and use it in GitHub Desktop.
This script adds a latlng() function to your Google Spreadsheets so you can easily convert addresses into latitudes and longitudes.
function latlng(address){
var response = Maps.newGeocoder().geocode(address);
if (response.status == "OK"){
var result = response.results[0];
return '' + result.geometry.location.lat + ',' + result.geometry.location.lat + '';
}
else{
return '0,0';
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment