Exception: Service invoked too many times for one day: geocode
Is this a Bug or a malfunction?
This is one of the two most common warnings, some users are getting. We are putting together some notes, references, and comments here for further reference, with the promise of updating this post as we learn more about this quota limit.
Is this a bug, an error, a malfunction of the Mapping Sheet add-on?
I would say, No.
However, it is a limitation even though temporary, specially for Gmail accounts, when mapping "too many" markers at once (in one day).
This warning is related with the Google Geocoding service daily quota limit.
The good news is that you can view a partial map showing all the locations that have been already geo-coded and you can continue building your map the next day.
More details about Geocoding service daily quota:
- There is a daily quota limit on the number of calls to the Google Geocoding service (used to convert an address into numeric map coordinates, Latitude / Longitude) from each user.
- The Geocoding service daily quota limit depends on the type of Google account you are using. A Gmail free consumer account has a smaller quota than a G Suite (formerly Google Apps) paid account.
- We haven't found an official reference on those limits, however as some users have reported, the Geocoding limit for a Gmail free account is about 1,000 locations per day, while for a G Suite paid account is around 10,000 locations per day. Also, consider that for other Apps Script quotas, Google applies the consumer limit to newly created G Suite domains for one or more billing cycles.
- When you hit that daily quota limit, there is not too much you can do, other than wait until next day
- Geocoding quota usually gets cleared after 24 hours or so.
What the add-on does to optimize the use of your Geocoding service quota?
- If the location (address) is empty (blank) in your data sheet, the add-on will not call the Geocoding service
- Only new addresses will call the Google Geocoding service and count against your quota, because the add-on keeps a sheet (hidden by default) with name Geocoding within your spreadsheet. This sheet is acting as a cache repository for all calculated coordinates (latitude, longitude). Find more details on this FAQ
- The add-on skips any address that won't return OK from the Geocoding service and keeps going, showing a "Warning: Problem mapping these addresses" when finished. Please, review and fix those addresses
Other recommendations around the Geocoding:
- If you haven't been able to see your complete map yet, because you have too many items in your list, you can always VIEW your partial map. You can also check the Geocoding sheet to see what is already saved there
- If you get a "Warning: Problem mapping these addresses", please fix o clear them to avoid using your quota on those no valid addresses.
- If you already have the numeric map coordinates (Latitude and Longitude) for all or some of the items in your list, there is a way of using them, instead of calling the Geocoding service.
- If you hit that daily quota limit but you cannot wait until next day to complete your map: you can share the spreadsheet with another Google account (if you feel it's suitable) and continue / complete the Geocoding from there
Other things the add-on does to optimize the use of your Geocoding service:
- There is a small delay between each Geocoding calls, to avoid another possible quota limit ("Exception: Service invoked too many times in a short time: geocode"). Currently that delay is 100 ms, and so far we are not getting that error
- There is a cap on the number of Geocoding calls per session (on each BUILD), just pausing to avoid the Script execution time limit (6 minutes). Currently that cap is around 5 minutes per session. If you hit that time limit, you will get a "Warning: Too many calls in one session". Please, be aware that keep building the map after this warning, might get you to exceeding your daily quota limit