Properties Service

  • The Properties service allows scripts to store key-value pairs with different scopes: script, user, or document.

  • TheProperties object provides methods for accessing and managing key-value pairs within a specific property store.

  • ThePropertiesService provides methods to get property stores for the document, script, or user.

  • ScriptProperties andUserProperties are types of persistent key-value stores with script-wide or user-specific scopes respectively.

Properties

This service allows scripts to store strings as key-value pairs scoped toone script, one user of a script, or one document in which aneditor add-on is used.For more information about when to use each type of property, see theguide to the Properties service.

Classes

NameBrief description
PropertiesThe properties object acts as the interface to access user, document, or script properties.
PropertiesServiceAllows scripts to store simple data in key-value pairs scoped to one script, one user of ascript, or one document in which an add-on is used.
ScriptPropertiesScript Properties are key-value pairs stored by a script in a persistent store.
UserPropertiesUser Properties are key-value pairs unique to a user.

Properties

Methods

MethodReturn typeBrief description
deleteAllProperties()PropertiesDeletes all properties in the currentProperties store.
deleteProperty(key)PropertiesDeletes the property with the given key in the currentProperties store.
getKeys()String[]Gets all keys in the currentProperties store.
getProperties()ObjectGets a copy of all key-value pairs in the currentProperties store.
getProperty(key)StringGets the value associated with the given key in the currentProperties store, ornull if no such key exists.
setProperties(properties)PropertiesSets all key-value pairs from the given object in the currentProperties store.
setProperties(properties, deleteAllOthers)PropertiesSets all key-value pairs from the given object in the currentProperties store,optionally deleting all other properties in the store.
setProperty(key, value)PropertiesSets the given key-value pair in the currentProperties store.

PropertiesService

Methods

MethodReturn typeBrief description
getDocumentProperties()PropertiesGets a property store (for this script only) that all users can access within the opendocument, spreadsheet, or form.
getScriptProperties()PropertiesGets a property store that all users can access, but only within this script.
getUserProperties()PropertiesGets a property store that only the current user can access, and only within this script.

ScriptProperties

UserProperties

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.