2

I have a form for internships and I am passing over the address of the internship provider to a function which gives me latitude and longitude for it, which is then consumed by a webmap using tabletop to leaflet.

The function works like this:

function getLat(address) {
  if (address == '') {
    Logger.log("Must provide an address");
    return;
  }
  var geocoder = Maps.newGeocoder();
  var location;
  // Geocode the address and plug the lat in the result
  location = geocoder.geocode(address);
  // Only change cells if geocoder seems to have gotten a
  // valid response.
  if (location.status == 'OK') {
    lat = location["results"][0]["geometry"]["location"]["lat"];
    return lat;
  }
};

My problem: I am only having 15 entries in the result spreadsheet but it gives me already the error Service invoked too many times for one day: geocode. (line 10, file "Code"). The function is working for new entries as I am only using =GetLat(B13) as an example.

My question: is there a way to store the result of a succesfull function result, like using =continue(A2,2,1) instead of copy-pasting of the getLat/getLon function to the one-hundred rows of the spreadsheet or to prevent the reevaluation of the function after some time?

(You can find the document here.)

1

So the solution is the correct usage of project triggers. you can use them to control the webapp to run only on form submit:enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.