Skip to main content
2 of 4
added script and image

Apps Script: how to frozen cell values do avoid "invoked too many times per second" error?

I make a Google Apps Script, but often I get this error Script invoked too many times per second in this Google user account.

enter image description here

This is the script:

function papersControl(tipo, col, prev_cell, quant) {
  
  var cell = 0;
  var gender = tipo.split(" ");

  if (tipo == col) {
    cell = parseInt(prev_cell,10) + parseInt(quant,10);
    return cell;
    }
  
  if ( (col == "Special Paper") && (gender[0] == "Certificate") && (gender[2] != "Voucher") ) {
    cell = parseInt(prev_cell,10) + parseInt(quant,10);
    return cell;
    }
  
  if ( (col == "Special Paper 2") && (gender[0] == "Certificate") && (gender[2] == "Vouncher") ) {
    cell = parseInt(prev_cell,10) + parseInt(quant,10);
    return cell;    
    }
  
  else
     return prev_cell;
}

I'd like to freeze the past recorded values in a cell in order to reduce the number of "times per second" that the script invokes Google servers, freezing these old values ​which I don't need have computed anymore. How can I do this​​?