Nathan Gartner
Nathan Gartner

Reputation: 21

How to send email to myself when a condition is met on Google Sheets

I'm looking for a way to send an email to myself using a script when a condition is met on a google sheet. I have no idea where to start on this one. What I want to do is when column "i" changes to "Re-apply PGR" instead of "None" to email me when it changes. Here is a copy link to my project if it helps https://docs.google.com/spreadsheets/d/1EkCBCxLIZBToFkdnBpBZenZOsqEg5KaDXVB6nrbEbt0/edit?usp=sharing

Upvotes: -1

Views: 1870

Answers (2)

Cooper
Cooper

Reputation: 64042

Basic onEdit code

If the change is caused by a user edit then you can use the onEdit trigger.[

function onEdit(e) {
  const sh = e.range.getSheet();
  if(sh.getName() == "High Low Temp Option" && e.range.columnStart == 9 && e.range.rowStart > 11 && e.value == "Re-apply PGR" ) {
    //Send email code here
  }
}

Upvotes: 1

Stepan
Stepan

Reputation: 19

Try this:

function checkValue()
{
  var ss = SpreadsheetApp.getActive();
var sheet = ss.getSheetByName("High Low Temp Option");

var valueToCheck = sheet.getRange("I:I").getValue();

if(valueToCheck="Re-apply PGR")
{
  MailApp.sendEmail("[email protected]","Testing test","1231323"+ valueToCheck+ ".");
}
}

Upvotes: -1

Related Questions