In this post, I demonstrate how to create an email notification on Google Form Submit using Google Apps Script.
How to Video:
Video Notes:
- Google Form Documentation
Code in Video:
function submitForm() {
record_array = [];
var form = FormApp.openById(''); // Form ID
var formResponses = form.getResponses();
var lastResponse = formResponses.length;
var formTitle = form.getTitle();
var formResponse = formResponses[lastResponse - 1];
var itemResponses = formResponse.getItemResponses();
for (var j = 0; j < itemResponses.length; j++) {
var itemResponse = itemResponses[j];
var title = itemResponse.getItem().getTitle();
var answer = itemResponse.getResponse();
Logger.log(title);
Logger.log(answer);
record_array.push(answer);
}
MailApp.sendEmail("", // Email Address
"Response - " + formTitle,
"From Name - " + record_array[0]);
}
Related Posts
Populate Options on Google Forms From Google Sheets - In this post, I demonstrate how to take options on a Google Sheet and populate those options onto Google Forms Questions using Apps Script.
Google Form – Using Apps Script to Populate Google Sheet - In this post, I take a Google Form and populate a Google Sheet by using Google Apps Script. The Apps Script adds versatility in populating a Google Sheet.