google apps script - setNote Last Modified value -
function onedit(e){ // set comment on edited cell indicate when changed. var range = e.range; range.setnote('last modified: ' + new date()) }
this works, add line in note. add last value of cell modified. example, if change cell value .01 .02. note have new date changed , .01 display in note. have reference of value before changed. tried add line....
range.setnote('last recorded entry: '+ getvalue())
but must have wrong. or need combine previous line?
this should trick
function onedit(e){ // set comment on edited cell indicate when changed. var range = e.range; var oldvalue = e.oldvalue; var notetext = 'last modified: ' + new date(); if (oldvalue != null){ notetext += 'last recorded entry: ' + oldvalue; } range.setnote(notetext); }
basically, old value of edited cell using
var oldvalues = e.oldvalues
note: work if 1 cell modified @ time. check see if null => if no previous value found dont add note
if (oldvalue != null){ notetext += 'last recorded entry: ' + oldvalue; }
hope helps
Comments
Post a Comment