スクリプトプロパティ
スクリプト プロパティを使用すると、特定のオブジェクト インスタンスに対して簡単にカスタム プロパティを定義および公開できます。
詳しくは、スクリプト プロパティに関するドキュメントをご覧ください。
GASの「プロジェクトの設定」より引用
「プロジェクトの設定」の「スクリプトプロパティ」から設定可能。
https://gyazo.com/ddf467457680cfae54f2decb7a652cc3
code:スクリプトプロパティの取得例.js
function getGyazoAccessToken() {
const token = PropertiesService.getScriptProperties().getProperty('GYAZO_ACCESS_TOKEN');
if (!token) {
throw new Error('GYAZO_ACCESS_TOKEN が設定されていません。');
}
return token;
}
code:スクリプトプロパティの利用例.js
const options = {
"method": "post",
"muteHttpExceptions": true,
"payload": {
access_token: getGyazoAccessToken(),
imagedata: imageBlob
}
};
#GAS #プロパティサービス