My script has been running smoothly in Apps Script for the past three weeks, but it suddenly stopped working a few days ago. I noticed that there are multiple executions happening at the same time and many of them are timing out with an error message saying "exceeded maximum execution time".
Here is the script:
function onEdit(e) {
const sh = e.range.getSheet();
if (sh.getName() == 'B2B_LeadList' && e.range.columnStart === 22 && e.range.rowStart > 1 && e.value === 'STARTED') {
sh.getRange(e.range.rowStart, 23).setValue(new Date());
}
if (sh.getName() == 'B2B_LeadList' && e.range.columnStart == 35 && e.value == 'YES') {
var tsh = e.source.getSheetByName('B2B_Archive');
var trg = tsh.getRange(tsh.getLastRow() + 1, 1);
sh.getRange(e.range.rowStart, 36).setValue(new Date());
sh.getRange(e.range.rowStart, 1, 1, sh.getLastColumn()).moveTo(trg);
sh.deleteRow(e.range.rowStart);
}}
Does anyone have any suggestions on how to modify the script or any workarounds to get it operational again? Thank you!
Tweaking the script