Form Submit custom triggers and logs
Google Form Auto respond and custom Logger source code for form project how to create a custom apps script Logger.
Google Form Submit Capture onSubmit custom Google Apps Script Code Create custom Logger Lesson
Download PDF
function mySubmit(e) {
Logger.log(JSON.stringify(e));
addLog(e.namedValues);
const email = Session.getActiveUser().getEmail();
const html = JSON.stringify(e.namedValues);
if(e.namedValues['Email Address'][0] != null){
MailApp.sendEmail({
to:e.namedValues['Email Address'][0],
subject:'Thank You',
htmlBody:html
});
}
MailApp.sendEmail({
to:email,
subject:'Form Submit',
htmlBody:html
});
}
function addLog(data){
const ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('log');
//ss.appendRow([JSON.stringify(data)]);
ss.appendRow([data['Number'][0],data['Email Address'][0],data['Timestamp'][0]]);
}