Created
July 15, 2021 08:10
-
-
Save auycro/e06d0bfd9526ea6bc6ac14f14aa58c9a to your computer and use it in GitHub Desktop.
check lat lng appscript
This file contains 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 printLatLng(input){ | |
var r = Maps.newGeocoder().geocode(input); | |
for (var i = 0; i < r.results.length; i++) { | |
var res = r.results[i]; | |
console.log(input, res.geometry.location.lat + ", " + res.geometry.location.lng); | |
} | |
} | |
function myFunction() { | |
/** @OnlyCurrentDoc */ | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var addresses = sheet.getRange('D2:D82').getValues(); | |
for (var i = 0; i < addresses.length; i++){ | |
//if (addresses[i] != "") console.log(addresses[i]); | |
if (addresses[i] != ""){ | |
var address = addresses[i]; | |
var r = Maps.newGeocoder().geocode(address); | |
printLatLng(r); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment