本页列出了各个版本的 Google Apps 脚本的主要更改。它旨在帮助开发者识别近期行为变更。如需了解早期变更,请参阅 2021、2020、2019、2018、2017、2016、2015、2014 2、2、2、2
2022 年 12 月
2022 年 12 月 16 日
Apps 脚本已弃用通讯录服务。请改用 People API 高级服务。 请参阅从通讯录服务迁移到 People API 高级服务。
Apps 脚本将于 2023 年 4 月停用通讯录服务。请参阅 Apps 脚本停用时间表。
2022 年 11 月
2022 年 11 月 3 日
Apps 脚本为 Utilities 类添加了一个新方法。
parseDate(date, timeZone, format)
根据 Java 标准版 SimpleDateFormat 类中所述的规范解析提供的字符串日期。
2022 年 11 月 1 日
Apps 脚本已停用以下方法:
没有使用 Apps 脚本获取此类数据的替代方法。
2022 年 9 月
2022 年 9 月 27 日
Apps 脚本已停用旧版集成式开发环境 (IDE),改为使用 2020 年 12 月发布的经过重新设计的 IDE。
阅读以下博文,详细了解 IDE 更新:
- 更新后的 Apps 脚本集成开发环境将于 2022 年第 4 季度取代旧版体验
- 适用于 Apps 脚本集成开发环境 (IDE) 脚本编辑器的其他功能
- 使用新的 Apps 脚本集成开发环境 (IDE) 脚本编辑器
2022 年 7 月
2022 年 7 月 19 日
现在,如果 Apps 脚本的关联脚本连续 180 天或更长时间未运行,系统会自动删除默认 Google Cloud 项目(Apps 脚本在后台创建的 Google Cloud 项目)。如果脚本在 Apps 脚本删除默认的 Google Cloud 项目后运行,则 Apps 脚本会为它创建一个。
此更新不会影响标准 Google Cloud 项目(用户创建的 Google Cloud 项目)。
2022 年 7 月 8 日
Apps 脚本已弃用以下方法:
Google 将于今年晚些时候将所有用户从传统版 Hangouts 改用 Google Chat 后,您将无法使用这些方法。没有使用 Apps 脚本获取此类数据的替代方法。
2022 年 6 月
2022 年 6 月 6 日
现在,您可以在解析之前在不同的文件中调用函数。以前,V8 运行时要求先解析一个脚本文件,然后再调用任何其他文件定义的函数。
现在,Apps 脚本编辑器中的文件顺序无关紧要。这意味着,您可以调用其他文件中的函数,为全局变量赋值,函数始终会在调用之前定义。此行为反映了旧版 Rhino 运行时的行为。
在此示例中,如果在解析 Second.gs
脚本文件之前解析了 First.gs
脚本文件,则会发生以下错误:
First.gs// This no longer fails in V8 if Second.gs isn't // parsed by the time First.gs is // being parsed. var globalVar = calculate(); function myFunction() { Logger.log("globalVar = %s", globalVar); } |
秒.gs// A utility function saved in a separate // file (Second.gs) in the same script // project. function calculate() { return Math.random(); } |
2022 年 4 月
2022 年 4 月 13 日
您现在可以在新的 Apps 脚本集成开发环境 (IDE) 中执行以下操作:
- 为编辑器插件创建测试部署。
- 在项目设置页面添加、修改和删除脚本属性。
- 在编辑器中按字母顺序对文件排序。
- 在不迁移到 V8 运行时的情况下调试 Rhino 函数。如果您的代码与 V8 不兼容,您可能会收到错误消息。
- 为脚本项目设置时区。
2022 年 3 月
2022 年 3 月 24 日
对于 Google Workspace 插件,Card Service 中新增了一个 Attachment
类,以便您向日历活动添加自定义附件。您还可以在 Google 日历下拉菜单中设置当用户点击插件附件提供程序时触发的事件触发器。如需了解详情,请参阅 EventAttachmentTrigger
。
2022 年 3 月 18 日
弃用了电子表格服务中几种颜色对象的 get
方法,取而代之的是新的命名惯例。该功能保持不变。例如,Range
类中的 getFontColor()
方法已替换为 getFontColorObject()
。
以下类更新了颜色对象的 get
方法:
Banding
getFirstColumnColor()
现在为getFirstColumnColorObject()
。getFirstRowColor()
现在为getFirstRowColorObject()
。getFooterColumnColor()
现在为getFooterColumnColor()
。getFooterRowColor()
现在为getFooterRowColorObject()
。getHeaderColumnColor()
现在为getHeaderColumnColorObject()
。getHeaderRowColor()
现在为getHeaderRowColorObject()
。getSecondColumnColor()
现在为getSecondColumnColorObject()
getSecondRowColor()
现在为getSecondRowColorObject()
。
BooleanCondition
getBackground()
现在为getBackgroundObject()
。getFontColor()
现在为getFontColorObject()
。
GradientCondition
getMaxColor()
现在为getMaxColorObject
。getMidColor()
现在为getMidColorObject
。getMinColor()
现在为getMinColorObject
。
Range
getFontColor()
现在为getFontColorObject()
。getFontColors()
现在为getFontColorObjects()
。
Sheet
getTabColor()
现在为getTabColorObject
。
Slicer
getBackgroundColor()
现在为getBackgroundColorObject()
。
2022 年 2 月
2022 年 2 月 14 日
当组织外部人员在新的集成开发环境 (IDE) 中修改脚本项目时,所有者会收到电子邮件提醒。
对于容器绑定脚本:如果容器所有者组织以外的人员创建或修改了容器绑定脚本项目,则容器所有者会收到电子邮件通知。
对于独立脚本:如果脚本项目所有者所在组织以外的人员修改了独立脚本项目,则脚本项目所有者会收到电子邮件通知。
2022 年 1 月 19 日
电子表格服务中添加了以下类,以便您向单元格添加图片:
CellImageBuilder
:此构建器会创建将图片添加到单元格所需的图片值。CellImage
:表示要添加到单元格中的图片。
如需向单元格添加图片,您必须使用 SpreadsheetApp.newCellImage()
和 CellImageBuilder
为图片创建新的图片值。然后,使用 Range.setValue(value)
或 Range.setValues(values)
将图片值添加到单元中。