Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
Archive rows going to very bottom of sheet. Not right under last row

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());
    }
  }
  }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!