I'm having some issues regarding this script for sending an email after the submit of google form.
So, when I run my code I receive this error message: ReferenceError: getValues is not defined at onFormSubmit
Below you can find the script
function onFormSubmit(e) {
Logger.log("[METHOD] onFormSubmit");
sendEmail(e.range);
}
function sendEmail(range) {
Logger.log("[METHOD] sendEmail");
// FETCH SPREADSHEET //
var values = range.getValues();
var row = values[0];
// EXTRACT VALUES //
var DateRequest = values[0]
var TypeRequest = values[1]
var StartDate = values[2]
var EndDate = values[3]
var Observation = values[4]
var TLemail = values[5]
// CLEAN VARIABLES //
if (Observation.length == 0) Explain = "None";
// PREPARE EMAIL //
var emailRecipients = +TLemail+"@google.com";
var emailSubject = TypeRequest;
var emailBody = "<h3>Vacation Request:</h3><hr /> \
<p> \
<strong>Type or request:</strong><br /> \
"+TypeRequest+" \
</p><p> \
<strong>Date of Request:</strong><br /> \
"+DateRequest+" \
</p><p> \
<strong>Start Date:</strong><br /> \
"+StartDate+" \
</p><p> \
<strong>End Data:</strong><br /> \
"+EndDate+" \
</p><p> \
<strong>Aditional comment:</strong><br /> \
"+Observation+" \
</p><p> \
</p>";
// SEND EMAIL //
MailApp.sendEmail({
to: emailRecipients,
subject: emailSubject,
htmlBody: emailBody
});
}
Thanks in advance