Search code examples
google-apps-scriptgoogle-workspacequota

Exception: Service invoked too many times for one day: urlfetch but I'm under limit


Hello I have this function in a linked Google Sheets Google Apps Script. It's being called in 30,000 rows in the sheet. I have a paid G Suite Basic account. According to Google Documentation I should be able to make 100,000 URLFetch calls https://developers.google.com/apps-script/guides/services/quotas

The function is

function GetLatNLon(Input) {
  var api = "myapikey";
  var base = "https://maps.googleapis.com/maps/api/geocode/json?address=";
  var url = base + Input + "&key=" + api;
  var response = UrlFetchApp.fetch(url);
  var data = JSON.parse(response);
  var Lat = data.results[0].geometry.location.lat;
  var Lon = data.results[0].geometry.location.lng;
  var LatNlon = Lat + ", "+ Lon;
  return LatNlon;
}

Solution

  • Assuming this function is actually called once per line as you've said, I do notice this note below quota table:

    Note: Newly created G Suite domains are subject to the consumer limit for the first billing cycle if they have six or more users, or several billing cycles if they have fewer users. For more information, see the Help Center page on sending limits.

    So perhaps this is the case.