列出Google应用脚本项目

问题描述 投票:1回答:1

我正在尝试使用Google Drive File API列出我所有的Google脚本文件,如here所示。但是我总是得到一个空的[]列表。我认为我的令牌和我的范围很好,因为我从Google OAuth2中取回了这个:

{ "access_token": "xxxxx", "expires_in": 3600, "refresh_token": "yyyyy",
"scope": "https://www.googleapis.com/auth/drive.scripts https://www.googleapis.com/auth/drive.appdata https://www.googleapis.com/auth/drive",
"token_type": "Bearer"
}

但是当我使用mimeType过滤发出查询时(我只想获取谷歌应用程序脚本列表):

mimeType = 'application/vnd.google-apps.script'

即使我刚刚在Google表格中创建了一个谷歌脚本,我也只回到空项目列表([]):

{ "kind": "drive#fileList", "etag": "....", "selfLink": "https://www.googleapis.com/drive/v2/files?q=mimeType+%3D+'application/vnd.google-apps.script'", "incompleteSearch": false, "items": []}

我猜这个应用程序脚本意味着谷歌脚本代码以外的东西,这是Google表格的一部分...任何帮助赞赏:)

google-apps-script google-drive-api google-authentication
1个回答
2
投票

关于检索容器绑定脚本类型的项目的文件列表并从项目中导出每个脚本,请检查以下答案。

Retrieve file list of projects of container-bound script type

  • 遗憾的是,无法检索容器绑定脚本类型的项目的文件列表,而可以使用Drive API的drive.files.list检索独立类型的项目的文件列表。 这已被报告为未来的请求。 https://issuetracker.google.com/issues/111149037

Export scripts in a project

  • 如果要从包含容器的脚本类型和独立类型的项目中导出每个脚本,可以使用Google Apps Script API执行此操作。 这可能会成为适合您情况的GAS示例脚本。 here。 您也可以使用像this这样的GAS库来完成它。
© www.soinside.com 2019 - 2024. All rights reserved.