清单结构
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页介绍了 Apps 脚本项目的清单文件 JSON 数据结构的顶层。清单定义了 Apps 脚本项目的功能或用途。
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 脚本在脚本级处理授权。
需要授权的聊天应用在用户授权之前无法执行任何操作。如需在授权之前发布消息,您可以向清单添加 addToSpaceFallbackMessage 对象。如果您的 Chat 应用需要初始化逻辑,您可能需要在 onMessage 操作中复制此逻辑。
以下示例展示了一个 Chat 应用,当用户将其添加到 Chat 聊天室时,该应用会回复一条默认的欢迎消息:
"chat": {
"addToSpaceFallbackMessage": "Thank you for adding me!"
}
|
dependencies |
object (Dependencies)
为脚本项目启用以供使用的
高级服务和库的配置。
|
exceptionLogging |
string
记录异常的位置。有效设置如下:
|
executionApi |
object (ExecutionApi)
脚本项目的 API 可执行配置。仅当项目部署用于 API 执行时,才会使用此配置。
|
oauthScopes[] |
string
脚本项目使用的授权范围的定义。
|
runtimeVersion |
string
脚本使用的运行时版本。如果清单中没有此字段,脚本会使用默认运行时 (STABLE )。此字段的有效选项如下:
STABLE 表示默认运行时(目前为 Rhino)。
V8 表示由 V8 提供支持的运行时。
DEPRECATED_ES5 表示 Rhino 运行时。设置此值还会阻止自动迁移到 V8。
|
sheets |
object (Sheets)
用于定义
Google 表格宏的资源配置。
|
timeZone |
string
脚本时区,采用可用的
ZoneId 值之一,例如“America/Denver”。
|
urlFetchWhitelist[] |
string
HTTPS 网址前缀的列表。如果存在,提取的任何网址端点都必须与此列表中的一个前缀匹配。这有助于保护用户数据。对于测试部署,此字段是可选字段,但对于部署,此字段是必填字段。详细了解如何将网址列入许可名单。
|
webapp |
object (Webapp)
脚本项目的 Web 应用配置,仅当项目部署为 Web 应用时使用。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):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,[]]