Can any help with the following issue??? Pretty new to app script / javascript and would appreciate any help or guidance to figure out..
TypeError: Cannot find function offset in object Timestamp, (then continues listing the column headings in the red warning banner.
function uiSendLogEmail() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var data = sheet.getDataRange().getValues();
data = data.offset(1,0,data.getNumRows())-1;
// For Loop
for ( var i = 0; i < data.length; i++ ) {
var row = data[i];
var approved = row[5];
var sentEmail = row[6];
var snapshot = row[3];
//if stmt in For Loop
if ( approved != "Yes" ) {
data[i][5] = "Yes";
data.getDataRange().setValues(data);
}// if stmt end curly
else if ( approved == "Yes" && sentEmail != "Yes" ) {
data[i][6] = "Yes";
data.getDataRange().setValues(data);
GmailApp.sendEmail("email@email.com", "subject", "body" + "whatever " + snapshot);
}//else if end curly
else {
return;
}//else stmt end curly
}// for loop end curly
}
I made a few basic tweaks that will hopefully point you in the right direction (and thanks to @AdamL for the
.shift()method – much better than what I had in there before 🙂 ):