enter image description hereI have the below code working in apps script. It does what it is supposed to as in auto archiving and deleting the rows when a checkbox is selected. The only hiccup is it is archiving the rows to the very bottom of the archive sheet, not right under the last archived row. It skips a lot of blank rows for some reason.
function onEdit(e) {
const sh = e.range.getSheet();
if (sh.getName() == "ACTIVITY REPORT" && e.range.columnStart == 1 && e.value == "TRUE") {
var tsh = e.source.getSheetByName("Archive");
var target = tsh.getRange(tsh.getLastRow() + 1, 1);
sh.getRange(e.range.rowStart, 1, 1, sh.getLastColumn()).moveTo(target);
}
if (sh.getName() == 'Archive' && e.range.rowStart > 1 && e.range.columnStart == 11
&& (e.value == 'NP CND A ACCEPTED' || e.value == 'NP BACKGROUND')) {
SpreadsheetApp.flush();
e.range.offset(0, 16).setValue(new Date());
}
if (sh.getName() == 'Archive' && e.range.rowStart > 1 && e.range.columnStart == 11)
{
let ops = ['NP CND A ACCEPTED', 'NP BACKGROUND', 'HIRED INTERN-SP', 'HIRED SDR-
SP', 'HIRED', 'HIRED INTERN', 'HIRED SDR', 'HIRED SDR', 'NP AS', 'NP LDR', 'NP CND A
AR', 'NP CND A OFFER', 'NO SHOW', 'NP ORL', 'NP CND A Zoom Int', 'NP CND A 1 FL'];
if (~ops.indexOf(e.value)) {
e.range.offset(0, 14).setValue(new Date());
}
}
}