snowblind
snowblind

Reputation: 81

Google Sheets AppsScript - Send an email when 1 cell changes to False

I've found a few AppsScript examples but nothing that matches what I am trying to do.

I have a google sheet and I want to recieve an email if 1 particular cell value changes from TRUE to FALSE. This cell has an IF function and will change based on other events. I just want an email if the value changes to false.

I know I need to create a function in AppsScript and a trigger event but I just cant seem to get the code correct.

The tab in the sheet is HealthMon and the Cell that I am looking at is F2. Any help would be appreciated.

thanks

Upvotes: 0

Views: 52

Answers (1)

Fernando Lara
Fernando Lara

Reputation: 2416

Try the following script:

function emailSender(e) {
  var ss = SpreadsheetApp.getActive().getSheetByName('HealthMon');
  var r = ss.getRange("F2");
  if(r.getValue()==true)
  {
    GmailApp.sendEmail("[email protected]", "Test subject", "This is a test message");
// Change the email address to the desired one
  }
}

Make sure to add the following trigger

enter image description here

References:

Upvotes: 2

Related Questions