使用google电子表格api(javascript)写入Google电子表格时出错

时间:2018-03-20 10:50:38

标签: javascript google-spreadsheet-api

我试图在js中实现Google表格API,并且读取功能正常但在尝试在电子表格中写入内容时,我收到以下错误。 这是片段: -

Error

PS:这是关于堆栈溢出的第一个问题,所以试着忽略任何错误

 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": {
"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."
      }
    ]
  }
]}}

0 个答案:

没有答案