使用的代码
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": {
"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."
}
]
}
]
}
}
我更改了谷歌电子表格的访问设置,以允许任何拥有其链接的人查看和编辑它。仅当我尝试写入电子表格时才会出现此错误,我可以使用其他函数读取电子表格。
没有人知道您将哪些域列入白名单,因此没有人可以复制您的代码。并且您的电子表格没有Class Data
工作表,你错误地尝试写在A1:C1
not A1:A4
.
所以我添加了一张纸并进行了更改values
并尝试与API浏览器 https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update。结果是200 OK
。也许你可以尝试'RAW'
代替"RAW"
or/and values: values
代替resource: body
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)