Skip to content

Object reference

Properties

Properties store text values under names you choose, called keys, and keep them between runs. Use getProperty() and setProperty() to read and save them. PropertiesService.getScriptProperties() is shared across the project, user properties are per-person, and document properties are per-file.

PropertiesService.Properties

Start here

Get this object first

Get the script properties store. It is the one most guides use, since its values are the same for everyone who runs the script.

Code.gs
function showScriptPropertyKeys() {
  const properties = PropertiesService.getScriptProperties();
  Logger.log(properties.getKeys());
}

Then use it

Common actions

Choose an action, then open its example only when you need the code.

Set and read a property (this saves a value)

Saves one key and its value to script properties, then reads it back. Other saved keys are not changed.

PropertiesService.Properties
Show example code
Code.gs
function setAndReadLastRunProperty() {
  const properties = PropertiesService.getScriptProperties();
  properties.setProperty('lastRunDate', new Date().toISOString());
  Logger.log(properties.getProperty('lastRunDate'));
}

List every saved key

Logs the names of the keys saved in script properties.

PropertiesService.Properties
Show example code
Code.gs
function logAllScriptPropertyKeys() {
  const properties = PropertiesService.getScriptProperties();
  const keys = properties.getKeys();
  Logger.log(keys.join(', ') || 'No properties saved');
}

Delete one property (this removes a saved value)

Deletes one key from script properties. Other saved keys are not changed.

PropertiesService.Properties
Show example code
Code.gs
function deleteLastRunProperty() {
  const properties = PropertiesService.getScriptProperties();
  properties.deleteProperty('lastRunDate');
  Logger.log('Deleted lastRunDate.');
}

Technical reference

Exact names and signatures

Open method details when you need them.

At a glance

Service
PropertiesService
Reference symbol
PropertiesService.Properties
Object
Properties
Runtime
From signature data

Methods and signatures

Browse 7 methods

deleteAllProperties

From signature data Google source
  • deleteAllProperties(): PropertiesService.Properties

deleteProperty

From signature data Google source
  • deleteProperty(key: string): PropertiesService.Properties

getKeys

From signature data Google source
  • getKeys(): string[]

getProperties

From signature data Google source
  • getProperties(): { [key: string]: string }

getProperty

From signature data Google source
  • getProperty(key: string): string | null

setProperties

From signature data Google source
  • setProperties(properties: { [key: string]: string }): PropertiesService.Properties
  • setProperties(properties: { [key: string]: string }, deleteAllOthers: boolean): PropertiesService.Properties

setProperty

From signature data Google source
  • setProperty(key: string, value: string): PropertiesService.Properties

Need the whole workflow?

Return to a task guide

Task guides cover setup, permissions, expected results, and troubleshooting as well as object methods.

Browse Script utilities tasks