Manuel
Manuel

Reputation: 9522

How to store values across google app script executions?

How can I store a key value on first executions of a google app scripts and retrieve it at a later execution?

I thought about using the cache, but I'm unclear how long it will survive and there is quite some time between my last and my previous execution.

Thx, I really appreciate your help and expertise a lot!

Upvotes: 4

Views: 1775

Answers (1)

Manuel
Manuel

Reputation: 9522

Thx to @Tanaike for providing solution as a comment.

Google App Scripts PropertiesService provides the possibility to store variables in the context of the script, user or document which accesses it:

var userProperties = PropertiesService.getUserProperties();
userProperties.setProperties({
  "key1": "value1",
  "key2": "value2"
});

Upvotes: 3

Related Questions