I have some troubles adding rows to a spreadsheet.
In short I do the next things:
My update code looks like this
UpdateValuesResponse updateResponse = this.mService.spreadsheets().values().update(spreadsheetId, _range, updateValueRange);
where updateValueRange
is my new list of rows (of type ValueRange
)
The question is the next.
I know that google api requires a ValueInputOption
to be specified in the request. But what I do is a call of Google Sheets API method that doesn't require such a parameter as ValueInputOption
.
Where should I set this ValueInputOption
?
Thank you all for your efforts to help me!
I have finally found the answer.
In order to set the value of ValueInputOption
you can to use batchUpdate()
method.
You can use it the next way:
BatchUpdateValuesRequest batchRequest = new BatchUpdateValuesRequest();
batchRequest.setValueInputOption("RAW");
batchRequest.setData(updateValueRangeList);
BatchUpdateValuesResponse updateResponse = this.mService.spreadsheets().
values().batchUpdate(spreadsheetId, batchRequest).
execute();
You set it to the result of update as in:
this.mService.spreadsheets().values().update(spreadsheetId, _range, updateValueRange).setValueInputOption("RAW");
hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.