I want to update the next rows in a spreadsheet with some data and for that, I need to find the last row. However, I need to get the last value in column A and not other columns. The function below works well and gets me the last row in column A that has value but returns that one and I need the row below the one with the value.
function getLastDataRow(sheet) {
var lastRow = sheet.getLastRow();
var range = sheet.getRange("A" + lastRow);
if (range.getValue() !== "") {
return lastRow;
} else {
return range.getNextDataCell(SpreadsheetApp.Direction.UP).getRow();
}
}
I am new to both JavaScript (python user) as well as Google Apps Script so I could really use some help with this as I have been trying all evening to get the first row in column A that is empty after the one with the value. For example if A20 has the last value, I want to return 21 and not 20.