title: Google form script to send email
body: <p>I'm having some issues regarding this script for sending an email after the submit of google form.</p>
  
  <p>So, when I run my code I receive this error message: <strong>ReferenceError: getValues is not defined at onFormSubmit</strong></p>
  
  <p>Below you can find the script</p>
  
  <pre><code>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 = "&lt;h3&gt;Vacation Request:&lt;/h3&gt;&lt;hr /&gt; \
    &lt;p&gt; \
    &lt;strong&gt;Type or request:&lt;/strong&gt;&lt;br /&gt; \
    "+TypeRequest+" \
    &lt;/p&gt;&lt;p&gt; \
    &lt;strong&gt;Date of Request:&lt;/strong&gt;&lt;br /&gt; \
    "+DateRequest+" \
    &lt;/p&gt;&lt;p&gt; \
    &lt;strong&gt;Start Date:&lt;/strong&gt;&lt;br /&gt; \
    "+StartDate+" \
    &lt;/p&gt;&lt;p&gt; \
    &lt;strong&gt;End Data:&lt;/strong&gt;&lt;br /&gt; \
    "+EndDate+" \
    &lt;/p&gt;&lt;p&gt; \
    &lt;strong&gt;Aditional comment:&lt;/strong&gt;&lt;br /&gt; \
    "+Observation+" \
    &lt;/p&gt;&lt;p&gt; \
    &lt;/p&gt;";
  
  
    // SEND EMAIL //
    MailApp.sendEmail({
    to: emailRecipients,
    subject: emailSubject,
    htmlBody: emailBody
   });
  }
  </code></pre>
  
  <p>Thanks in advance</p>