高级表格服务
借助高级 Google 表格服务,您可以使用 Apps 脚本访问 Google 表格 API。与 Apps 脚本的内置 Google 表格 API 服务非常相似,此 API 允许脚本在 Google 表格中读取、修改、设置格式和呈现数据。在大多数情况下,内置服务更易于使用,但此高级服务提供了一些额外的功能。
参考
如需详细了解此服务,请参阅 Google 表格 API 的参考文档。与 Apps 脚本中的所有高级服务一样,高级 Google 表格服务使用的对象、方法和参数均与公共 API 相同。如需了解详情,请参阅如何确定方法签名。
如需报告问题和查找其他支持,请参阅 Google 表格支持指南。
示例代码
以下示例代码使用的是该 API 的版本 4;这是目前唯一可在 Apps Script 中作为高级服务使用的 Google 表格 API 版本。
从范围中读取值
以下示例演示了如何使用 Google 表格高级服务从工作表中的指定范围读取数据值。这相当于读取单个范围方案示例。
将值写入多个范围
以下示例演示了如何通过一个请求将数据写入工作表中不相交的不同范围。这等效于写入多个范围食谱示例。
添加新工作表
以下示例演示了如何创建具有特定大小和标签页颜色的新工作表。这相当于添加工作表配方示例。
创建数据透视表
以下示例演示了如何根据来源数据创建数据透视表。
这相当于添加数据透视表配方示例。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-21。
[null,null,["最后更新时间 (UTC):2024-12-21。"],[[["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."]]],[]]