I'm a construction worker trying to create an apps scripts for our work task list in google sheets. My code is below (this code worked when there were just 2 sheets (task list & completed task list). Once I added multiple job task sheets (along with multiple "completed" task sheet, the code doesn't work anymore. I've tried adding sheet names, but it still didn't work, so I rolled it back to this initial script that did work (for 2 sheets only).
function onEdit(e){ if (!e) throw "Do not run from Editor. This function runs automatically whenever an edit is made." moveToCompleted(e);}function moveToCompleted(e){ const src = e.source.getActiveSheet(); const r = e.range; if (src.getName() != "CochranTaskList","CartisanoTaskList" || r.columnStart != 1 || r.rowStart < 4) return; const dest = SpreadsheetApp.getActive().getSheetByName("CompletedCochranTasks","CompletedCartisanoTasks"); src.getRange(r.rowStart,1,1,3).moveTo(dest.getRange(dest.getLastRow() +1, 1,1,3)); src.deleteRows(r.rowStart);}