0
votes

I'm trying to create a script in Google Sheets that will send me an automated email every time that a value within a given column ("Column H") drops below a certain threshold. I've currently got the following script written, which includes an installable onEdit trigger. However, the script is not running when the spreadsheet is edited:

function StationeryEdited(e){
    var sheet = SpreadsheetApp.getActiveSheet();
    var data = sheet.getRange(2, 8, 200, 1).getValues();
    var newValue = e.value;
    if (newValue < "10"){
       MailApp.sendEmail("[email protected]", "TEST", "TEST");
    }

function createSpreadsheetEditTrigger(){
    var ss = SpreadsheetApp.getActive();
    ScriptApp.newTrigger(StationeryEdited)
       .forSpreadsheet(ss)
       .onEdit()
       .create();
    }  
}
2

2 Answers

-1
votes

Try this and set the installable trigger through the script editor:

function onEdit(e) {
  var editColumn=e.range.getSheet().getActiveCell().getColumn()
  if(editColumn==8 && e.value>10){ 
    MailApp.sendEmail("[email protected]", "TEST", "TEST");
  }}
0
votes

Have you tried putting function name in quotation marks like this?

ScriptApp.newTrigger('StationeryEdited')

Also, you can simply go to Edit -> Current project triggers and configure the trigger for your function manually select the following options for the 'StationeryEdited' function

enter image description here