apps script get last row code example
Example 1: google script last row
var cells = sheetInput.getRange("a:a").getValues();//Gets all cells in col A.
var filter = cells.filter((cell) => cell != "");//filters out the blanks.
var lr = parseInt(filter.length) + 1;//This is the Last Row.
Logger.log(lr);
Example 2: apps script get last row with data
var cur_ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var data = cur_ss.getDataRange().getValues();
var Avals = cur_ss.getRange("B9:B").getValues();
var Alast = Avals.filter(String).length;
return (Alast + 9);