Home > Enterprise >  How can I use an array formula with this reverse geocode script?
How can I use an array formula with this reverse geocode script?

Time:06-21

Here is the Google Script:

function reverse_geocode(lat,lng) {
Utilities.sleep(1500);

var response = Maps.newGeocoder().reverseGeocode(lat,lng);
for (var i = 0; i < response.results.length; i  ) {
var result = response.results[i];
Logger.log('%s: %s, %s', result.formatted_address, result.geometry.location.lat,
result.geometry.location.lng);
return result.formatted_address;
}
}

enter image description here

I'm trying to take coordinates from columns A and B and have them convert to an address after they appear in the sheet. I'd like to use an array here so the rows won't be used until they actually contain data. I followed this tutorial for the script: ex

This script successfully returns the closest addresses for a given range.

  • Related