Apps Script Jump in last unwritten Row

61 views
Skip to first unread message

Mrs Sykes

unread,
Nov 26, 2021, 7:02:22 PM11/26/21
to Google Apps Script Community
Hi folks,

i want to have a script where i can jump into the last row, which is empty that I don't have to scrowl down.
At the moment my script is jumping at the end of the compleet sheet. I don't know exactly how this works and i am testing, trying etc but i don't know what to do now.
It looks like this atm:
function Zeile(){
  var spreadsheet = SpreadsheetApp.getActive();
  var sheet = spreadsheet.getActiveSheet();
  var lastRow = spreadsheet.getLastRow();
  if (sheet.getMaxRows() == lastRow) {
    sheet.appendRow([""]);
  }
  lastRow = lastRow + 1;
  var range = sheet.getRange('C' + lastRow + ':C' + lastRow);
  sheet.setActiveRange(range);
} I want that this script jumps down at the last row in C. Its jumping to row 3579 at the moment instead of 1585. Can someone help me how I can fix this? Thanks MrsSykes

Zack Reynolds

unread,
Nov 26, 2021, 7:13:22 PM11/26/21
to google-apps-sc...@googlegroups.com
So, checkboxes, or any blank spaces in an arrayformula will mess up the last row calculation.

So if you have something like =arrayformula(IF(A2:A="","",RestOfFunction))
You need to change that to:
=arrayformula(IF(A2:A="",,RestOfFunction))


--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/67c45112-f546-4c91-9269-7807a52523fen%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages