google scripts onedit -> email trigger for range produces an email for each edit -


i know happening by-design i'm trying figure out how people deal - tried few different approaches think i'm not thinking right way ( i'm more of bash scripter :) ).

i have google sheet script onedit on range of cells: if cell in range edited, email sent. good!

now, if edits, 5 cells in range, 5 emails sent. bad!

so seems need way have each script run "know" each other , send email after amount of time after first cell edited?

i looked @ clue setting flag prevent other edits... https://developers.google.com/apps-script/articles/sending_emails#section2

i have imagine common thing figure out it's not coming me.

thanks guys ideas, jl

use script propertiesservice save timestamp. example script below send email once day.

https://developers.google.com/apps-script/reference/properties/

var settings = propertiesservice.getscriptproperties(); var lasteditemaildate = settings.getproperty('lasteditemaildate'); var today = new date().todatestring(); if (lasteditemaildate != today) {  /*send email*/  settings.setproperty('lasteditemaildate', today);     } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -