高级表格服务
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
通过高级 Google 表格服务,您可以使用 Apps 脚本访问 Google 表格 API。与 Apps 脚本的内置 Google Sheets API 服务非常相似,此 API 允许脚本读取、修改、设置格式和呈现 Google 表格中的数据。
在大多数情况下,内置服务更易于使用,但此高级服务提供了一些额外的功能。
参考
如需详细了解此服务,请参阅 Google Sheets API 的参考文档。与 Apps 脚本中的所有高级服务一样,高级 Google 表格服务使用的对象、方法和参数均与公共 API 相同。如需了解详情,请参阅方法签名是如何确定的。
如需报告问题并查找其他支持,请参阅Google 表格支持指南。
示例代码
以下示例代码使用 API 的版本 4;这是目前唯一可作为 Apps 脚本中的高级服务使用的 Google 表格 API 版本。
从范围中读取值
以下示例演示了如何使用 Google 表格高级服务从工作表中指定范围读取数据值。它相当于读取单个范围配方示例。
将值写入多个范围
以下示例演示了如何通过一个请求将数据写入工作表中的不同不相交范围。它相当于写入多个范围配方示例。
添加新工作表
以下示例演示了如何创建具有特定大小和标签页颜色的新工作表。它等效于添加工作表配方示例。
创建数据透视表
以下示例演示了如何根据源数据创建透视表。
它等效于添加数据透视表配方示例。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-04。
[null,null,["最后更新时间 (UTC):2025-08-04。"],[[["The Advanced Sheets service allows Apps Script to interact with the Sheets API, enabling scripts to read, edit, format, and present data within Google Sheets."],["This advanced service offers additional features beyond the built-in Google Sheets service, but requires enabling before use."],["The service utilizes the same objects, methods, and parameters as the public Sheets API, mirroring its functionality within Apps Script."],["It provides access to version 4 of the Sheets API, enabling actions such as reading and writing data, adding sheets, and creating pivot tables."]]],[]]