javascript - Service invoked too many times in a short time -
i'm getting error message following script. "service invoked many times in short time: exec qps. try utilities.sleep(1000) between calls."
i've given code below. can me stop error message? note: i'm using array formula imported sheet. trigger set work on change.
function onedit(e) { var ss = spreadsheetapp.getactivespreadsheet(); var sheet = ss.getsheetbyname('direct'); var range = sheet.getdatarange(); var values = range.getvalues(); var rows_deleted = 0; (var = 0; < values.length; i++) { (var j = 0; j < values[i].length; j++) { var value = values[i][j]; //row numbers 1-based, not zero-based for-loop, add 1 and... //every time delete row, of rows move down one, subtract count var row = + 1 - rows_deleted; //if type number, don't need if (typeof value === 'string') { var result = value.search("remove"); //the .search() method returns index of substring, or -1 if not found //we care if found, test not -1 if (result !== -1) { sheet.deleterow(row); rows_deleted++; } } } } };
Comments
Post a Comment