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

Saves a single key-value pair.

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

Better Sheets tutorials

Built a Cookie Clicker Clone in Google Sheets

Built a Cookie Clicker Clone in Google Sheets

I built a clone of Cookie Clicker, live on YouTube. Watch the full 1 hou...
Visicalc 2023 Design Walkthrough

Visicalc 2023 Design Walkthrough

Design walkthrough of VisiCalc 2023. Watch this if you'd like to see the...
Visicalc 2023 Quick Walkthrough

Visicalc 2023 Quick Walkthrough

This is a fun template I created for April 1st. Take a quick walk throug...