資訊清單結構
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本頁說明 Apps Script 專案資訊清單檔案的頂層 JSON 資料結構。資訊清單會定義 Apps Script 專案的功能或用途。
JSON 表示法 |
{
"addOns": {
object (AddOns)
},
"chat": {},
"dependencies": {
object (Dependencies)
},
"exceptionLogging": string,
"executionApi": {
object (ExecutionApi)
},
"oauthScopes": [
string
],
"runtimeVersion": string,
"sheets": {
object (Sheets)
},
"timeZone": string,
"urlFetchWhitelist": [
string
],
"webapp": {
object (Webapp)
}
} |
欄位 |
addOns |
object (AddOns)
如果專案部署為
Google Workspace 外掛程式,則為專案的資源設定。
|
chat |
object
如果以
Google Chat 應用程式的形式部署專案,則為專案的設定。 注意:如果是新的 Chat 應用程式,建議改用 addOns.chat 欄位。如果您要維護使用 chat 欄位的現有 Chat 應用程式,該欄位應為空白物件。
如要設定 Chat 應用程式的詳細資料,請啟用 Google Chat API。詳情請參閱「設定 Google Chat API」。
Apps Script 會在指令碼層級處理授權。
需要授權的 Chat 應用程式必須先取得使用者授權,才能執行任何動作。如要在授權前發布訊息,可以在資訊清單中新增 addToSpaceFallbackMessage 物件。如果 Chat 應用程式需要初始化邏輯,您可能需要在 onMessage 動作中複製這項邏輯。
以下範例顯示 Chat 應用程式,使用者將其新增至 Chat 聊天室時,應用程式會以預設歡迎訊息回覆:
"chat": {
"addToSpaceFallbackMessage": "Thank you for adding me!"
}
|
dependencies |
object (Dependencies)
為指令碼專案啟用
進階服務和程式庫,並設定這些服務和程式庫。
|
exceptionLogging |
string
記錄例外狀況的位置。有效設定如下:
NONE 表示系統不會記錄例外狀況。
STACKDRIVER 表示例外狀況記錄在 Stackdriver 中。
|
executionApi |
object (ExecutionApi)
指令碼專案的 API 可執行檔設定。只有在專案部署用於執行 API 時,才會使用這項設定。
|
oauthScopes[] |
string
指令碼專案使用的授權範圍定義。
|
runtimeVersion |
string
指令碼使用的執行階段版本。如果資訊清單中沒有這個欄位,指令碼會使用預設執行階段 (STABLE )。這個欄位的有效選項如下:
STABLE 表示預設執行階段 (目前為 Rhino)。
V8 表示以 V8 為基礎的執行階段。
DEPRECATED_ES5 表示 Rhino 執行階段。設定這個值也會防止系統自動遷移至 V8。
|
sheets |
object (Sheets)
定義
試算表巨集的資源設定。
|
timeZone |
string
指令碼時區,可使用其中一個可用的
ZoneId 值,例如「America/Denver」。
|
urlFetchWhitelist[] |
string
HTTPS 網址前置字元清單。如果有的話,擷取的任何網址端點都必須符合這份清單中的其中一個前置字元。這有助於保護使用者資料。這個欄位在測試部署中為選填欄位,但部署時必須填寫。進一步瞭解如何將網址加入許可清單。
|
webapp |
object (Webapp)
指令碼專案的網頁應用程式設定,只有在專案部署為網頁應用程式時才會使用。
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eThe manifest file defines the configuration of an Apps Script project, including add-ons, Chat apps, dependencies, and execution settings.\u003c/p\u003e\n"],["\u003cp\u003eThe manifest uses a JSON structure with top-level fields like \u003ccode\u003eaddOns\u003c/code\u003e, \u003ccode\u003echat\u003c/code\u003e, \u003ccode\u003edependencies\u003c/code\u003e, \u003ccode\u003eexceptionLogging\u003c/code\u003e, \u003ccode\u003eexecutionApi\u003c/code\u003e, \u003ccode\u003eoauthScopes\u003c/code\u003e, \u003ccode\u003eruntimeVersion\u003c/code\u003e, \u003ccode\u003esheets\u003c/code\u003e, \u003ccode\u003etimeZone\u003c/code\u003e, \u003ccode\u003eurlFetchWhitelist\u003c/code\u003e, and \u003ccode\u003ewebapp\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eEach top-level field provides specific configurations for different aspects of the project like add-on types, Chat app behavior, external libraries, and runtime environment.\u003c/p\u003e\n"],["\u003cp\u003eThe manifest structure allows developers to control various aspects of their Apps Script project, such as authorization scopes, exception logging, and the execution environment.\u003c/p\u003e\n"],["\u003cp\u003eDetailed substructures and examples are provided in separate pages for each top-level field within the manifest file.\u003c/p\u003e\n"]]],[],null,[]]