0

I have a Google Apps script that runs every minute, performing tasks on Gmail messages.

How to have a persistant variable that I can access on subsequent calls of the script main.gs?

I just need a simple int variable like:

var lastaction = Math.round((new Date()).getTime() / 1000);

Then, during the next call of main.gs, I need to check several things based on the date + elapsed time since the last action (even if the script is run every minute, an action is not necessarily performed every minute).

Note: I've already read Persistant variable in Google Apps Script but it seems a bit complicated for this simple task here (just keep an integer timestamp of the last action done by a previous call of the script)

Basj
  • 41,386
  • 99
  • 383
  • 673
  • 1
    Complicated or not, that's the only way. – TheMaster Mar 20 '20 at 10:41
  • Thank you for your answer @TheMaster. This is the final goal: https://stackoverflow.com/questions/60773329/run-a-gmail-google-apps-script-daily-at-800-1230-1700. Would you have any idea? – Basj Mar 20 '20 at 11:33

0 Answers0