title: Google Scripts for Sheets - onEdit and "source"
body: <p>I've been struggling for a few days now trying to get a script to work. At its most basic level my function contains this: </p>
  
  <pre><code>function onEdit(e) {
  
  var changedRange = e.source.getActiveRange()
  
  }
  </code></pre>
  
  <p>It seems this is a perfectly legitimate use according to Google's docs: <a href="https://developers.google.com/apps-script/guides/triggers/events" rel="nofollow">https://developers.google.com/apps-script/guides/triggers/events</a></p>
  
  <p>This code however produces this error: </p>
  
  <p><code>TypeError: Cannot read property "source" from undefined. (line 18, file "Code")</code></p>
  
  <p>I've added a trigger for onEdit as well but this still does not work in the script. Am I missing something? </p>