May I don't know how to call another function when reached last row of register code column on google sheet, users click the submit on google form will auto email out another sendMail function to said that eg 'registration had been closed, thank you.'
my code :
function sendmail() {
var ss = SpreadsheetApp.getActive();
var sh1 = ss.getSheetByName("Sheet1");
var EMAIL_SENT = "EMAIL_SENT";
var lastRow = sh1.getLastRow();
var email = sh1.getRange(lastRow, 2).getValue();
var name = sh1.getRange(lastRow, 1).getValue();
var registercode = sh1.getRange(lastRow, 3).getValue();
subjecttxt = "Thank you for registered with us"
email_Body = "Dear " + name + "," + "<br>" +
"your registeration is successfully, your registered code is " + registercode +
"Thank you for your registeration"
MailApp.sendEmail({
to:email,
subject: subjecttxt,
htmlBody: email_Body,
}) ;
sh1.getRange(lastRow, 4).setValue(EMAIL_SENT);
}
