Skip to content

Latest commit

 

History

History
100 lines (61 loc) · 3.24 KB

README.md

File metadata and controls

100 lines (61 loc) · 3.24 KB
Български Deutsch English Русский Українська

SettingsService

Release License clasp

SettingsService works similarly to PropertiesService but with enhanced capabilities.

The current modification reduces the load on system limits when reading and writing properties. This is achieved through parallel data storage in CacheService.

Note! Using this service may increase script execution time.

Installation

  1. Open your project in the Google Apps Script Dashboard.
  2. Copy the contents of the settings.js file and paste it into a new file in your Google Apps Script project.

Documentation

For detailed documentation, please visit the Wiki page.

Usage

Getting a settings instance

Retrieve settings for a document, script, or user:

// Document settings
const documentSettings = SettingsService.getDocumentSettings();

// Script settings
const scriptSettings = SettingsService.getScriptSettings();

// User settings
const userSettings = SettingsService.getUserSettings();

Saving data

Use methods or proxies to save data:

// Using the method
scriptSettings.setProperty('email', '[email protected]');

// Using a proxy
scriptSettings.email = '[email protected]';

Data retrieval

Use methods or proxies to retrieve data:

// Using the method
const email = scriptSettings.getProperty('email');

// Using a proxy
const email = scriptSettings.email;

Tasks

  • Create a method settings.setProperties(properties, deleteAllOthers).
  • Create a method settings.getKeys().
  • Create method settings.getProperties().
  • Create a method settings.deleteAllProperties().
  • Use a recursive proxy to track changes to the object tree in settings._values, this should also create a hierarchy of objects, e.g.: settings._values.prop1.m1.m2 = 5;.

Contribution

Please read CONTRIBUTING.md for details on how to contribute to this project.

Change History

Please refer to CHANGELOG.md for a detailed list of changes and updates.

License

This project is licensed under the LICENSE.md file.