title: TypeError: Cannot read property "range" from undefined
body: <p>I have written this google app script. 
  Purpose: Every time I edit "Location Update" script should send an email to "Broker Email".
  <a href="https://docs.google.com/spreadsheets/d/1Lfl06sDNhtbumzjWottLnsBu0b_GB15d2ypH_Dbz_EY/edit?usp=sharing" rel="nofollow">Here is Link to spread sheet</a>: </p>
  
  <pre class="lang-html prettyprint-override"><code>function onEdit(e) {
    var activateSheet = SpreadsheetApp.getActiveSpreadsheet();
    SpreadsheetApp.setActiveSheet(activateSheet.getSheetByName('Responses'));
    var sheet = SpreadsheetApp.getActiveSheet();
    var range = e.range;
    var row = e.range.getRowIndex();//Gets the row the change was made to.  
  
    var timestamp = sheet.getRange(row, 1).getValues(); //Gets the email
    var load = sheet.getRange(row, 2).getValues(); //Gets the email
    var email = sheet.getRange(row, 3).getValues(); //Gets the email
    var location = sheet.getRange(row, 4).getValues(); //Gets the email
    var template = HtmlService.createTemplateFromFile("template");
   template.load = load;
   template.location =location;
  
  
    MailApp.sendEmail(email,"Hi","this is my email",{htmlBody: template.evaluate().getContent()});
     }
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;h1&gt;&lt;b&gt;This is a Check-In call for load number: &lt;?= load ?&gt;&lt;/b&gt;&lt;/h1&gt;
  &lt;p&gt;
  &lt;?= location ?&gt;
  &lt;/p&gt;
  &lt;p&gt;
  Please do not reply this email, we don't read these emails. If you have any questions/concers please &lt;a href="google.com"&gt;Click Here&lt;/a&gt;. We will get back to as soon as we can.
  &lt;/p&gt;
  &lt;/html&gt;
  </code></pre>