function getLatestValue(range) { var spreadsheetObj = SpreadsheetApp.getActiveSpreadsheet(); var sheet = spreadsheetObj.getSheetByName("sheet"); var range = sheet.getRange(range); var col = range.getColumn(); var lastRow = sheet.getLastRow(); var value = sheet.getRange(lastRow, col).getValue(); return value; }