title: Can't get my Google Apps script on Sheets to trigger automatically
body: <p>I made myself a code for Google Sheets that sends me an automatic email whenever a condition is met.
  I have managed to make this work, but only when I manually edit the sheet - I need it to trigger automatically when the sheet changes itself.</p>
  <p>My Sheet manages my subscriptions for my clients, whenever the cell on the first column goes to the number 3 - that row is marked as &quot;impending&quot; - and ideally sends me the email.
  (The number 3 automatically appears whenever the expiry date of that item is under 2 weeks).</p>
  <p>Please let me know if you think you can spot where I haven't set thing up properly :)
  Thanks!</p>
  <p><strong>In Google Apps Script I've tried setting the trigger</strong> (but can't get it to be automatic)</p>
  <pre><code>Choose which function to run
  sendMailEdit
  
  Which runs at deployment
  Head
  
  Select event source
  From spreadsheet
  
  Select event type
  On edit (also tried On change)
  </code></pre>
  <p><strong>And here's my code:</strong></p>
  <pre><code>    function sendMailEdit(e){
    if (e.range.columnStart != 1 || e.value !=3) return;
    const rData = e.source.getSheetByName('SUBSCRIPTIONS').getRange(e.range.rowStart,1,1,14).getValues();
  
    let mis = rData[0][1];
    let dat = new Date(rData[0][2]).toLocaleDateString(&quot;en-US&quot;);
    let cos = rData[0][3];
    let aut = rData[0][4];
    let typ = rData[0][5];
    let des = rData[0][6];
    let pro = rData[0][7];
    let not = rData[0][8];
    let cnu = rData[0][9];
    let cna = rData[0][10];
    let sta = rData[0][13];
    let now = new Date().toLocaleString(&quot;en-US&quot;);
  
    
    let msg = &quot;:: AUTOMATED EMAIL FROM - NP PROJECTS SHEET 2021 / SUBSCRIPIONS PAGE :: &quot; + &quot;\n&quot; + &quot;\n&quot; + sta + &quot; SUBSCRIPTION FOR: &quot; + &quot;\n&quot; + dat + &quot; (&quot; + mis + &quot; days missing)&quot;  + &quot;\n&quot; + &quot;Cost: &quot; + cos + &quot;$&quot; + &quot;\n&quot; + &quot;Is autopay active: &quot; + aut + &quot;\n&quot; + &quot;\n&quot; +&quot;CLIENT: &quot; + cna + &quot; (&quot; + cnu + &quot;)&quot; + &quot;\n&quot; + &quot;\n&quot; + &quot;Product: &quot; + typ + &quot;\n&quot; + &quot;\n&quot;+&quot;Descprition: &quot; + des  + &quot;\n&quot; + &quot;\n&quot; + &quot;Provider: &quot; + pro  + &quot;\n&quot; + &quot;\n&quot;+ &quot;Notes: &quot; + not  + &quot;\n&quot; + &quot;\n&quot;+ &quot;\n&quot; + &quot;(This email was triggered at:&quot; +  now + &quot;)&quot;;
    
    Logger.log(msg);
    GmailApp.sendEmail(&quot;myemail@gmail.com&quot;, &quot;IMPENDING SUBSCRIPTION (automail)&quot;, msg)
  }
  </code></pre>