I have a google form with the following columns:
Name | email | have_kids
where Name is just text input, email is just an email, and have_kids is a yes/no radio button
ex. dmkumar | [email protected] | Yes
when the user submits the form, the data is sent to a google spreadsheet. I would like to have it set up so that if the user selected "Yes" to have_kids, then an email is sent to that user. Here is the code I have right now. I have a trigger event to run the function, from the spreadsheet, on the form submit.
Here is the code I have now (that is not working):
function emailConfirmation(e) {
var userEmail = e.values[11]; //column k
var check = e.values[14]; //column n
/**
* Un-comment this to use it for debugging
*/
//for (var i in e.values) {
// Logger.log("" + i + ":" + e.values[i]);
//}
var subject = "Sending email from a spreadsheet";
var message = "Hello World";
if(check == "Yes")
{
MailApp.sendEmail(userEmail, subject, message);
}
}
I am new to google scripting, so simple explanations would be much appreciated! Thanks!
.sendEmail()is working for you at all. LikeMailApp.sendEmail("[email protected]","Test","This is a test email");. - Tricky12