In google Sheet API guide,
I read that a find
request (find the cell with value 'X') can be formatted as follows in JSON:
{
"find": string,
"replacement": string,
"matchCase": boolean,
"matchEntireCell": boolean,
"searchByRegex": boolean,
"includeFormulas": boolean,
// Union field scope can be only one of the following:
"range": {
object(GridRange)
},
"sheetId": number,
"allSheets": boolean,
// End of list of possible types for union field scope.
}
requests can be made in the form of this URL https://sheets.googleapis.com/v4/spreadsheets/spreadsheetId .......
But I'm not able to translate that to JAVA code
The closest I've found was this code in one of the forums:
requests.add(new Request().setFindReplace(new FindReplaceRequest().setFind(entry.getKey())
.setMatchEntireCell(true)
.setMatchCase(true)
.setReplacement(entry.getValue())
.setRange(new GridRange()
.setSheetId(0)
.setStartRowIndex(row)
.setEndRowIndex(row + 1))));
}
String cellReq = (new FindReplaceRequest().setFind("samuel")).getFind();
which lack a response that I expect from the API, letting me know which cell in the sheet has the value I'm trying to find.
thanks
{ "range":" Sheet1!a2:a6 " "values": [ [ " Book " ] [ " Cat " ] [ " House " ] [ " Tree " ] ] }
. This request basically defines a range of cells in Google sheet to be updated, and the values to be inserted into those cells. Yes I can create a client, but I'm using google's libraries, so the above JSON will be included in the code as ..... – Tlink