const ss = SpreadsheetApp.getActive(); const sh = ss.getSheetByName('Sheet1') const lrow = sh.getLastRow(); const Avals = sh.getRange("A1:A"+lrow).getValues(); const Alast = lrow - Avals.reverse().findIndex(c=>c[0]!='');