I have a function that sorts a table, unfortunately when I call my function it adds a bunch of empty rows at the bottom that I don't like.

var kotlijst = SpreadsheetApp.getActiveSpreadsheet()
kotlijst.getRange(7, 1, kotlijst.getLastRow()-4,
  kotlijst.getLastColumn()).sort({column: 2, ascending: false});

Is there any way to avoid this?


I did a bit of experimenting and I found the extra rows didn't get added as long as I had two or more rows after the range being sorted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.