Issue
I'm trying to write a row to a sheet using java and Google Sheets API v4. I'm getting an error that I just can't understand. Any help would be greatly appreciated!
The values passed are:
sRange = '09/03/2017 11:01:13 PM'!A1
body = {majorDimension=ROWS, values=[[Test ID, Test Name, Run ID, Status, Run Duration, Execution Date, Execution Time]]}
Here is the trouble code:
outputValues = Arrays.asList(Arrays.asList("Test ID", "Test Name", "Run ID", "Status", "Run Duration", "Execution Date", "Execution Time"));
sRange = "'" + sSheetName + "'" + "!" + sHeaderRow;
body = new ValueRange().setValues(outputValues).setMajorDimension("ROWS");
result = service.spreadsheets().values().update(sSpreadsheetID, sRange, body).setValueInputOption("RAW").execute();
And the result:
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Requested writing within range ['09/03/2017 11:01:13 PM'!A1], but tried writing to column [B]",
"reason" : "badRequest"
} ],
"message" : "Requested writing within range ['09/03/2017 11:01:13 PM'!A1], but tried writing to column [B]",
"status" : "INVALID_ARGUMENT"
}
Solution
I think sRange should be using A1 notation:
Something that looks like:
SheetName!A1:B2
Sheet1!A1
Check the link for more info.
Answered By - noogui
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.