Skip to content

Instantly share code, notes, and snippets.

@ttsukagoshi
Created January 18, 2020 16:29
Show Gist options
  • Save ttsukagoshi/e794892b7b12fe9dbcdf53cea7b7bbe8 to your computer and use it in GitHub Desktop.
Save ttsukagoshi/e794892b7b12fe9dbcdf53cea7b7bbe8 to your computer and use it in GitHub Desktop.
Ever wanted to export & import script properties in Google App Scripts? Here's a simple copy & paste method.
/**
* Script for the original Google App Script from which you want to export the script properties.
* Shows in the log the script properties in JSON-encoded object; use with scriptPropertiesImport() described below
*/
function scriptPropertiesExport() {
var properties = JSON.stringify(PropertiesService.getScriptProperties().getProperties());
Logger.log(properties);
}
/**
* Script for the new Google App Script to which you want to import the above-exported script properties.
* Copy & paste into the below var properties the JSON-encoded object shown in log after running scriptPropertiesExport()
*/
function scriptPropertiesImport() {
var properties = {'Copy and Paste here'};
PropertiesService.getScriptProperties().setProperties(properties, false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment