Created
January 18, 2020 16:29
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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