爪哇 |如何使用 API 在谷歌电子表格范围内查找值(行号和列号)? [英] Java | How to find a value (row and column number) in range of google spreadsheet using API?

查看:36
本文介绍了爪哇 |如何使用 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();

这篇关于爪哇 |如何使用 API 在谷歌电子表格范围内查找值(行号和列号)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆