Increase Google Spreadsheet Quota

2019-06-10 11:04发布

问题:

  1. ​What you are trying to achieve.

    We have a lot of spreadsheets that have scripts running by time triggers. Every run uses time trigger quota which has a cap of 6 hours a day for Google G suite. Imaging that we have 50 spreadsheets, each with an hourly trigger that runs a script that takes 3 minutes to run. In such a case, it will use 50*24*3 = 3600 minutes = 6 hours, i.e. all given qouta.

We are trying to be able to create as many spreadsheet with such time triggers as we need.

  1. The expected behaviour.

    All spreadsheets triggers running without failures.

  2. The actual behaviour

    We are getting error Service using too much computer time for one day

  3. Steps to reproduce your issue. ​

    Create time trigger that will run a script with 60 seconds runtime every minute and wait for 6 hours under G suite account, or create a 100 of such triggers in order not to wait so long. In such case you will get an error within 36 minutes.

回答1:

The Google Apps Scrpt - Quotas for Google Services page was "recently" updated. It now includes Flexible quotas for Early Access:

Normally, if a script execution exceeds one of the above quotas or limitations, the script execution stops and an appropriate error message is returned. This can potentially leave the script's data in an indefinite state.

Under the flexible quota system, such hard quota limits are removed. Scripts do not stop when they reach a quota limit. Rather, they are delayed until quota becomes available, at which point the script execution resumes. Once quotas begin being used, they are refilled at a regular rate. For reasonable usage, script delays are rare.

An alternative could be the use of other Google APIS like Google Drive REST API, Google Sheets API, etc.