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

174
Views
How to delete all rows from certain row to the LastRow?

I do not need to clear blank cells or anything. Just need to delete data from Row 800 to the Last Row.

My current code is as below, but it keeps return Range Not Found. How do I do it?

  function DeleteOld() {
    var spreadsheet = SpreadsheetApp.getActive();
    var lastRow = spreadsheet.getLastRow();
    spreadsheet.getRange('800:lastRow').activate();
    spreadsheet.getActiveSheet().deleteRows(spreadsheet.getActiveRange().getRow(), 
    spreadsheet.getActiveRange().getNumRows());
  Logger.log('Data Before 1990 deleted') 
  };

I tested the getLastRow function to see its number.

var spreadsheet = SpreadsheetApp.getActive();
Logger.log(spreadsheet.getLastRow())   };

The return is "12344.0" If I changed the code to getRange('800:12344"), it works well. If getRange('800:12344.0'), returns error.

Since the return of the getLastRow hass decimal point, could it be the reason? and How do I fix that?

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!