1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[GAS] 新エディタでGUIからスクリプト プロパティを設定

1
Last updated at Posted at 2022-06-02

スクリプト プロパティについて

Google Apps Script で API キーなどハードコーディングしたくない情報をコードから分離できる機能です。
なお、AWS Lambda は環境変数という同等機能があります。

設定方法

歯車マークをクリックし「プロジェクトの設定」を開きます。

image.png

一番下に「スクリプト プロパティ」があり、こちらから設定できます。

image.png

スクリプト プロパティは PropertiesService オブジェクトを使って取得できます。

code.gs
const API_KEY = PropertiesService.getScriptProperties().getProperty("API_KEY");

以前は

新エディタの GUI ではスクリプト プロパティを設定できませんでした。
2022年4月13日の公式ドキュメントに記載があるので最近できるようになったようです。

image.png

公式ドキュメント

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?