Saves a single key-value pair.
class PropertiesService method .setProperty()
PropertiesService is the Apps Script service.
.setProperty() is the method name you will see after a dot in your code.
What it does
Why it's used
- Save a token or timestamp after a successful run.
- Update one setting from an admin menu.
Common errors
- Forgetting parentheses on setProperty. Write PropertiesService.setProperty(), not PropertiesService.setProperty or setProperty by itself.
- Skipping dots between chained calls. Each step needs a dot, like PropertiesService.setProperty().
- Adding spaces where they do not belong. Write PropertiesService.setProperty(), not PropertiesService .setProperty(), PropertiesService.setProperty (), or PropertiesService . setProperty().
- Wrong capitalization. Use PropertiesService and setProperty, not propertiesservice or setproperty.
Explore
Related methods
-
.setProperties()
Saves multiple key-value pairs at once.
-
.deleteProperty()
Removes a stored value by key.
-
.getProperty()
Reads a single stored value by key.
-
.getProperties()
Returns all stored key-value pairs.
-
.getUserProperties()
Returns key-value storage private to the current user.
More Apps Script
Better Sheets tutorials
No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.