1

I've searched around and still can't find anything directly related to the failure message I'm receiving. The script hasn't changed and it used to run just fine, but now in the past week or so it's failing more and more often. There are only 3 triggers on this file onOpen, onEdit(e) and the installed trigger that calls the percentChange function once a day in the morning. It's super simple, it grabs 2 named ranges, one is a column of percentages and the other contains the length of that data and then copies the percentages to another column so that we can track the daily percentage difference.

Here is the code(link to a bare spreadsheet):

function percentChange() {
  var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Overview Status');

  var calcPercentRangeObject = ss.getRange('calcPerc');
  var calcPercentRow = calcPercentRangeObject.getRow()+2;
  var calcPercentColumn = calcPercentRangeObject.getColumn();

  var dataRangeObject = ss.getRange('numCabs');
  var dataRow = dataRangeObject.getRow()+2;
  var dataColumn = dataRangeObject.getColumn();
  var dataLength =  dataRangeObject.getValue();
  var currentPercent = ss.getRange(calcPercentRow, calcPercentColumn, dataLength, 1).getValues();

  ss.getRange(dataRow, dataColumn, dataLength, 1).setValues(currentPercent);

}

Should I add a delay? That seems like a "janky" workaround...

Latest failure

Previous failures and completions

Another question: why does this code take 10+seconds to run from the trigger but generally takes less than a second to run from the script editor?


Edit: It's not really a correct fix but I put in a 400ms delay after line 6 and have only gotten the error message once more...what an odd work around... This stopped working, I tried multiple delays spread out and removing the delay altogether. I still don't understand why it's intermittent without the code changing?!?!


I am the owner. It's shared with less than 60 people I created the trigger manually The only other installable trigger is onEdit() The script is set to run when no-one would really be looking at it a couple hours before the shift would start.

  • Please add more details about your environment. Are you the owner of this spreadsheet? Is it shared? How do you created the installable trigger? Do you have other installable triggers ? (check this on script.google.com/home/triggers). How long usually it takes to your spreadsheet to recalculate? – Rubén Jun 17 '19 at 20:54
  • I am the owner, shared with less than 60 people, trigger created manually, yes onEdit(), I'm not sure on the recalculate, if you manually run the script it's pretty much instant, the installable is set to run when no-one would really be looking at it a couple hours before the shift would start. – Micah Kuiper Jun 20 '19 at 16:12
  • How complex is your spreadsheet? (number of cells, sheets, use of volatile functions, use of array functions like MMULT, use of import functions like IMPORTRANGE..., custom functions) How long it usually takes the spreadsheet to be ready for editing when opening (recalculation time)? – Rubén Jun 20 '19 at 16:26
  • 1
    I've gotten the error message a few more times over the past couple weeks, this time it's yelling @line 13, so I put another 200mS delay there too...see if that helps...this is odd. Here's a "blank" copy to look at: docs.google.com/spreadsheets/d/… – Micah Kuiper Jun 27 '19 at 14:48
  • 1
    It's set to run once a day, and is the only time based trigger, at 5-6am. I'll submit to Google and see what comes up. Thanks – Micah Kuiper Feb 4 at 22:25
-1

0

https://developers.google.com/apps-script/guides/services/quotas

Script invoked too many times per second for this Google user account. This indicates that the script began executing too many times in a short period. It most commonly occurs for custom functions that are called repeatedly in a single spreadsheet. To avoid this error, code your custom functions so that they only need to be called once per range of data, as explained in the guide to custom functions.

| improve this answer | |
  • I don't think that tiny script is anywhere near those limits. – Micah Kuiper May 31 '19 at 17:39

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.