File
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
脚本项目中的单个文件。文件是由一位或多位开发者创建的第三方源代码。它可以是服务器端 JS 代码、HTML 或配置文件。每个脚本项目可以包含多个文件。
JSON 表示法 |
{
"name": string,
"type": enum (FileType ),
"source": string,
"lastModifyUser": {
object (User )
},
"createTime": string,
"updateTime": string,
"functionSet": {
object (FunctionSet )
}
} |
字段 |
name |
string
文件的名称。文件扩展名不是文件名的一部分,可以通过类型字段识别。
|
type |
enum (FileType )
文件的类型。
|
source |
string
文件内容。
|
lastModifyUser |
object (User )
最近修改文件的用户。此对象中显示的详细信息由上次修改用户的个人资料公开范围设置控制。
|
createTime |
string (Timestamp format)
创建日期时间戳。 时间戳采用 RFC3339 世界协调时间(UTC,即“祖鲁时”)格式,精确到纳秒,最多九个小数位。示例:"2014-10-02T15:01:23Z" 和 "2014-10-02T15:01:23.045123456Z" 。
|
updateTime |
string (Timestamp format)
上次修改日期时间戳。 时间戳采用 RFC3339 世界协调时间(UTC,即“祖鲁时”)格式,精确到纳秒,最多九个小数位。示例:"2014-10-02T15:01:23Z" 和 "2014-10-02T15:01:23.045123456Z" 。
|
functionSet |
object (FunctionSet )
脚本文件中定义的一组函数(如果有)。
|
FileType
枚举 |
ENUM_TYPE_UNSPECIFIED |
未确定的文件类型;从未实际使用过。 |
SERVER_JS |
Apps 脚本服务器端代码文件。 |
HTML |
包含客户端 HTML 的文件。 |
JSON |
JSON 格式的文件。此类型仅用于脚本项目的清单。清单文件内容必须与有效的 ScriptManifest 的结构匹配 |
FunctionSet
JSON 表示法 |
{
"values": [
{
object (Function )
}
]
} |
字段 |
values[] |
object (Function )
构成该集合的函数列表。
|
函数
JSON 表示法 |
{
"name": string,
"parameters": [
string
]
} |
字段 |
name |
string
脚本项目中的函数名称。
|
parameters[] |
string
脚本项目中函数的形参名称的有序列表。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-17。
[null,null,["最后更新时间 (UTC):2025-08-17。"],[[["\u003cp\u003eA file in a script project represents third-party source code and can be server-side JS, HTML, or a configuration file.\u003c/p\u003e\n"],["\u003cp\u003eEach script project can contain multiple files, each with properties like name, type, source code, and modification details.\u003c/p\u003e\n"],["\u003cp\u003eFiles can contain a set of functions, each defined by its name and parameters, contributing to the script's functionality.\u003c/p\u003e\n"],["\u003cp\u003eFiles can be of various types, including server-side JavaScript, HTML, JSON for the project manifest, ensuring diverse script capabilities.\u003c/p\u003e\n"]]],[],null,["# File\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n- [FileType](#FileType)\n- [FunctionSet](#FunctionSet)\n - [JSON representation](#FunctionSet.SCHEMA_REPRESENTATION)\n- [Function](#Function)\n - [JSON representation](#Function.SCHEMA_REPRESENTATION)\n\nAn individual file within a script project. A file is a third-party source code created by one or more developers. It can be a server-side JS code, HTML, or a configuration file. Each script project can contain multiple files.\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"name\": string, \"type\": enum (/apps-script/api/reference/rest/v1/File#FileType), \"source\": string, \"lastModifyUser\": { object (/apps-script/api/reference/rest/v1/projects#User) }, \"createTime\": string, \"updateTime\": string, \"functionSet\": { object (/apps-script/api/reference/rest/v1/File#FunctionSet) } } ``` |\n\n| Fields ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` The name of the file. The file extension is not part of the file name, which can be identified from the type field. |\n| `type` | `enum (`[FileType](/apps-script/api/reference/rest/v1/File#FileType)`)` The type of the file. |\n| `source` | `string` The file content. |\n| `lastModifyUser` | `object (`[User](/apps-script/api/reference/rest/v1/projects#User)`)` The user who modified the file most recently. The details visible in this object are controlled by the profile visibility settings of the last modifying user. |\n| `createTime` | `string (`[Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp)` format)` Creation date timestamp. A timestamp in RFC3339 UTC \"Zulu\" format, with nanosecond resolution and up to nine fractional digits. Examples: `\"2014-10-02T15:01:23Z\"` and `\"2014-10-02T15:01:23.045123456Z\"`. |\n| `updateTime` | `string (`[Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp)` format)` Last modified date timestamp. A timestamp in RFC3339 UTC \"Zulu\" format, with nanosecond resolution and up to nine fractional digits. Examples: `\"2014-10-02T15:01:23Z\"` and `\"2014-10-02T15:01:23.045123456Z\"`. |\n| `functionSet` | `object (`[FunctionSet](/apps-script/api/reference/rest/v1/File#FunctionSet)`)` The defined set of functions in the script file, if any. |\n\nFileType\n--------\n\nAn enumeration of different types of files.\n\n| Enums ||\n|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `ENUM_TYPE_UNSPECIFIED` | Undetermined file type; never actually used. |\n| `SERVER_JS` | An Apps Script server-side code file. |\n| `HTML` | A file containing client-side HTML. |\n| `JSON` | A file in JSON format. This type is only used for the script project's manifest. The manifest file content must match the structure of a valid [ScriptManifest](/apps-script/concepts/manifests) |\n\nFunctionSet\n-----------\n\nA set of functions. No duplicates are permitted.\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------|\n| ``` { \"values\": [ { object (/apps-script/api/reference/rest/v1/File#Function) } ] } ``` |\n\n| Fields ||\n|------------|------------------------------------------------------------------------------------------------------------------|\n| `values[]` | `object (`[Function](/apps-script/api/reference/rest/v1/File#Function)`)` A list of functions composing the set. |\n\nFunction\n--------\n\nRepresents a function in a script project.\n\n| JSON representation |\n|------------------------------------------------------|\n| ``` { \"name\": string, \"parameters\": [ string ] } ``` |\n\n| Fields ||\n|----------------|-------------------------------------------------------------------------------------|\n| `name` | `string` The function name in the script project. |\n| `parameters[]` | `string` The ordered list of parameter names of the function in the script project. |"]]