Reputation: 21
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
Reputation: 64042
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
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