javascript - Send email when cell content is changed due to forumula compiling data from another sheet -


i need google spreadsheet send email when there's changes cell.

problem is, appears in cell determined values of sheet (i used if , filter functions this).

the usual,

if(cell.indexof('f')!=-1){         mailapp.sendemail(emailaddress, subject, message); } 

doesn't seem capture change in cell since change brought formula compiling data sheet, however, send me email if manually type in stuff in column f.

the following whole code in script editor:

function initialize() {   var triggers = scriptapp.getprojecttriggers();   for(var in triggers) {     scriptapp.deletetrigger(triggers[i]);   }    scriptapp.newtrigger("sendnotification")   .forspreadsheet(spreadsheetapp.getactivespreadsheet())   .onedit()   .create(); };  function sendnotification(e) {   var ss = spreadsheetapp.getactivespreadsheet();   var sheet = ss.getactivesheet();   var cell = ss.getactivecell().geta1notation();   var datarange = sheet.getrange(2, 1, 2, 2);   var data = datarange.getvalues();   (i in data) {     var row = data[i]     var emailaddress = row[0];     var message = row[1];     var subject = "job exceeded time allocated";     if(cell.indexof('f')!=-1){       mailapp.sendemail(emailaddress, subject, message);     }   } } 

  1. there discussion of how extract value cell formula here:

get , set value of cell not work - getcell() returns range object.. need add .getvalue() method value of cell in range trying in script. found using getrange cell address works better: i.e. getrange ('b1').

  1. getcell not designed return value of cell rather return range object of cell, discussed here:

trying read cell 1,1 in spreadsheet using google script api

the cell object formula don't want that. hence using getrange meaning range of result of formula in 1 cell.

that sounds know more do. stumbled across problem myself , fixed indicated above.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -