Code used
var values = [
[
'value1','value2','value3'
]
];
var body = {
values: values
};
gapi.client.sheets.spreadsheets.values.update({
spreadsheetId: '1Lofhq9R7X5wzGvO7fMViN8D8q1W3fiNxO5jjP7XL_s0',
range: 'Sheet1!A1:A4',
valueInputOption:'RAW',
resource: body
}).then((response) => {
var result = response.result;
console.log(`${result.updatedCells} cells updated.`);
});
Error shown
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"valueInputOption\": Cannot bind query parameter. Field 'valueInputOption' could not be found in request message.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid JSON payload received. Unknown name \"valueInputOption\": Cannot bind query parameter. Field 'valueInputOption' could not be found in request message."
}
]
}
]
}
}
I changed the access settings in google spreadsheet to allow everyone who has the link to view and edit it. This error occurs only when I try to write to a spreadsheet, I can read the spreadsheet using other functions.
source
share