I tried to embed the Google Sheets API in js and the read function works fine, but when I try to write something in a spreadsheet, I get the following error. Here is a snippet: -

PS: this is my first stack overflow question, so try to ignore any errors
var values = [
[
"CO16338","CO16331","CO16330" ],
];
var body = {
values: values
};
gapi.client.sheets.spreadsheets.values.update({
spreadsheetId:'1k1s95YiuWMjeOCMmpj8DQaj705ZC6Uq4UC7pEEU0zko',
range:'!G1:G5',
valueInputOption:"RAW",
resource: body
}).then((response) => {
var result = response.result;
console.log(`${result.updatedCells} cells updated.`);
});
Error, detail:
{ "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."
}
]
}
]}}
Paras source
share