Randriakotonjanahary Tolotra S Randriakotonjanahary Tolotra S - 11 months ago 111
Java Question

Find and replace a value in google sheet via Java API V4

I would like to find a value and replace it to another value in google sheet using the Java API.

This is my code, but it only changes the value upon the index and column I refer to it.

requests.add(new Request()
.setCopyPaste(new CopyPasteRequest()
.setSource(new GridRange()
.setDestination(new GridRange()
BatchUpdateSpreadsheetRequest batchUpdateRequest = new BatchUpdateSpreadsheetRequest()

Answer Source

You can create a FindReplaceRequest() to do this

        requests.add(new Request().setFindReplace(new FindReplaceRequest().setFind(entry.getKey())
                .setRange(new GridRange()
                        .setEndRowIndex(row + 1))));

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