简体   繁体   English

获取和更新单个Google工作表(电子表格中的特定工作表)中的单元格

[英]get and update cells in individual google sheet (specific sheet in spreadsheet)

Google spreadsheets are made up of one or more individual sheets (shown as tabs on the bottom of the web ui). Google电子表格由一个或多个单独的工作表(在Web界面底部显示为标签)组成。 The v4 sheets api makes it fairly clear how to to manipulate cells in the default sheet in a spreadsheet, but I can't seem to figure out how to specify a different sheet for read/write operations. v4表格api使您可以很清楚地了解如何操作电子表格默认表格中的单元格,但是我似乎无法弄清楚如何为读/写操作指定其他表格。

Any information on how to do this with the java or rest api would be appreciated. 任何有关如何使用Java或rest api做到这一点的信息将不胜感激。

In the case of use for reading ( values.get ) and writing ( values.update ) data to cells for the existing Spreadsheet, you can use the specific sheet in the Spreadsheet using A1 notation for Range. 在用于读取( values.get )和将( values.update )数据写入现有电子表格的单元格的情况下,可以使用Spreadsheet中的特定表格,并使用Range的A1表示法。 The detail information of A1 notation is here . A1标记的详细信息在这里

Read operation : values.get 读取操作: values.get

About values.get of Sheets API v4 which is used for retrieving cell values in the sheet, You can see the sample script at here . 关于用于检索工作表中单元格值的Sheets API v4的values.get ,您可以在此处查看示例脚本。

In the sample script, you can retrieve the cell values by modifying String spreadsheetId = "my-spreadsheet-id"; 在示例脚本中,您可以通过修改String spreadsheetId = "my-spreadsheet-id";来检索单元格值String spreadsheetId = "my-spreadsheet-id"; and String range = "my-range"; String range = "my-range"; . For example, Sheet2!A1:B2 for the range retrieves the first two cells in the top two rows of Sheet2. 例如,范围的Sheet2!A1:B2检索Sheet2顶部两行中的前两个单元格。

Write operation : values.update 写入操作: values.update

About values.update of Sheets API v4 which is used for updating cell values in the sheet, You can see the sample script at here . 关于用于更新工作表中单元格值的Sheets API v4的values.update ,您可以在此处查看示例脚本。

In the sample script, you can update the cell values by modifying like the same to above. 在示例脚本中,可以通过与上面相同的修改来更新单元格值。

Note : 注意 :

If you use sample script, at first, please check Quickstart . 如果您使用示例脚本,请首先检查Quickstart After that, please check TODO in the sample script. 之后,请在示例脚本中检查TODO

If I misunderstand your question, I'm sorry. 如果我误解了您的问题,对不起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM