PropertiesService

Allows scripts to store simple data in key-value pairs scoped to one script, one user of a
script, or one document in which an add-on is used. Properties cannot be shared between scripts.
For more information about when to use each type of property, see the [guide to the Properties service](https://developers.google.com/apps-script/guides/properties).

```javascript
// Sets three properties of different types.
const documentProperties = PropertiesService.getDocumentProperties();
const scriptProperties = PropertiesService.getScriptProperties();
const userProperties = PropertiesService.getUserProperties();

documentProperties.setProperty('DAYS_TO_FETCH', '5');
scriptProperties.setProperty(
    'SERVER_URL',
    'http://www.example.com/MyWeatherService/',
);
userProperties.setProperty('DISPLAY_UNITS', 'metric');
```

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/properties/properties-service#getDocumentProperties()` | `https://developers.google.com/apps-script/reference/properties/properties` | Gets a property store (for this script only) that all users can access within the open document, spreadsheet, or form. |
| `https://developers.google.com/apps-script/reference/properties/properties-service#getScriptProperties()` | `https://developers.google.com/apps-script/reference/properties/properties` | Gets a property store that all users can access, but only within this script. |
| `https://developers.google.com/apps-script/reference/properties/properties-service#getUserProperties()` | `https://developers.google.com/apps-script/reference/properties/properties` | Gets a property store that only the current or effective user can access, and only within this script. |

## Detailed documentation

### `getDocumentProperties()`

Gets a property store (for this script only) that all users can access within the open
document, spreadsheet, or form. It is only available if the script is published and executing
as an add-on or if it is [bound](https://developers.google.com/apps-script/scripts_containers) to a Google file
type. When document properties are not available this method returns `null`. Document
properties created by a script are not accessible outside that script, even by other scripts
accessing the same document.

#### Return


`https://developers.google.com/apps-script/reference/properties/properties` --- A property store for this script only that all users of the current document can
access, or `null` if the script is not either an add-on or bound to a Google
Workspace file.

*** ** * ** ***

### `getScriptProperties()`

Gets a property store that all users can access, but only within this script.

#### Return


`https://developers.google.com/apps-script/reference/properties/properties` --- A property store that all users of the script can access.

*** ** * ** ***

### `getUserProperties()`

Gets a property store that only the current or effective user can access, and only within this
script.

#### Return


`https://developers.google.com/apps-script/reference/properties/properties` --- A property store that only the current or effective user of the script can access.