爪哇 |如何使用 API 在谷歌电子表格范围内查找值(行号和列号)?

我正在使用 Java API (V4) 从谷歌表格中读取和编辑数据.到目前为止,我能够根据行号和列号(索引)读取和编辑数据.

I am using the Java API (V4) to read and edit the data from a google sheet. So far, I am able to read and edit the data based on the row and column number (index).

  • 我要做的是通过数据的特定值本地化数据(我想使用其值获取特定单元格的行号和列号).

到目前为止,这是我用来编辑数据的工作代码的一部分:

So far this is a part of the working code I used to edit the data:

  // Copy the format from A1:C1 and paste it into A2:C5, so the data in 
// each column has the same background.             
requests.add(new Request()
                        .setCopyPaste(new CopyPasteRequest()
                                .setSource(new GridRange()
                                        .setSheetId(0)
                                        .setStartRowIndex(0)
                                        .setEndRowIndex(1)
                                        .setStartColumnIndex(0)
                                        .setEndColumnIndex(3))
                                .setDestination(new GridRange()
                                        .setSheetId(0)
                                        .setStartRowIndex(1)
                                        .setEndRowIndex(6)
                                        .setStartColumnIndex(0)
                                        .setEndColumnIndex(3))
                                .setPasteType("PASTE_FORMAT")));

                BatchUpdateSpreadsheetRequest batchUpdateRequest = new BatchUpdateSpreadsheetRequest()
                        .setRequests(requests);

谁能帮帮我?提前谢谢你.

Can anyone please help me? Thank you in advance.

推荐答案

根据 documentation,您可以使用 FindReplaceRequest().getFind();

According to the documentation, you can find the value using : FindReplaceRequest() and .getFind();

String cellReq = (new FindReplaceRequest().setFind("samuel")).getFind();

相关文章