I have a google sheets app script which fetch data from webpage and enter it in google spreadsheet.
Among others, when executed to the end, script fetch date written on the webpage and enter it in column A. I want that script fetch all data from the webpage only if date on the webpage (var date) is different from last date already entered in spreadsheet (var lastdate).
How to make var lastdate as value from last cell of column A?
Thanks in advance.
regularSheetName = "Regular method";
link = "http://...";
function checkDate(){
var page = UrlFetchApp.fetch(link).getContentText();
var ss = SpreadsheetApp.getActiveSpreadsheet();
var regularSheet = ss.getSheetByName(regularSheetName);
var Avals = ss.getRange("A1:A").getValues();
var Alast = Avals.filter(String).length;
var date = page.match(/results of (.*?) - with/m)[1];
var lastdate = regularSheet.getRange(Alast).getValue();
if(date != lastdate){
return SpreadsheetApp.getUi().alert("It's different");
}
Error:
Exception: Range not found