谷歌电子表格更新的正确语法-Javascript

谷歌电子表格更新的正确语法-Javascript,javascript,jquery,google-sheets,google-spreadsheet-api,Javascript,Jquery,Google Sheets,Google Spreadsheet Api,有人知道使用Javascript API更新Google电子表格中的行的正确语法吗 我正在处理API文档,但我不知道发送数据所需的正确语法是什么。我目前拥有的是: var serialObject = $('#basicForm').serialize(); $.ajax({ url: updateBasicUrl, type: 'PUT', data: serialObject, }); 数据字段的语法应该是什么(上面抛出了一个无法识别

有人知道使用Javascript API更新Google电子表格中的行的正确语法吗

我正在处理API文档,但我不知道发送数据所需的正确语法是什么。我目前拥有的是:

var serialObject = $('#basicForm').serialize();
$.ajax({
        url: updateBasicUrl,
        type: 'PUT',
        data: serialObject,
    });
数据字段的语法应该是什么(上面抛出了一个无法识别的错误)

编辑-将JSON对象转换为XML以符合XML的确切外观后,仍然无法工作:

var updateBasicUrl = "https://spreadsheets.google.com/feeds/list/*spreadsheetIDnumber*/od6/private/full/*cellID*/*versionnumber*?access_token=*accesstoken*
$.ajax({
        url: updateBasicUrl,
        type: 'PUT',
        contentType: 'application/atom+xml',
        //contentType: 'text/xml',  //tried both of these, they don't seem to work
        data: xmlBasic,
    })

编辑-因此似乎存在跨域来源问题。谷歌电子表格API不允许这样做。有人知道解决方案吗?

您可以在java源代码中搜索解决方案-

这将触发java版本中的发送: 插入(cellFeedUrl,newEntry)


我不知道如何将其转换为Javascript请求。我还认为API需要与Javascript PUT请求和Java请求不同的东西(尽管因为我不能真正理解Java,所以我不确定)。我希望请求数据是相同的。您的请求是否来自浏览器?我知道浏览器中的OAuth不太一样。。。这里有一个相关的问题:你能提供更多细节吗。i、 e.您的OAuth令牌。什么是你的updateBasicUrl等。。。我像这个电子表格服务一样设置了Oauth.setHeader(“授权”、“承载人”+accessToken);不知道你为什么需要我的OAuth代币。它的工作很好,因为我可以从电子表格下载很好,只是没有上传(我也没有得到一个权限被拒绝的错误)。
public void setCell(int row, int col, String formulaOrValue)
    throws IOException, ServiceException {

  CellEntry newEntry = new CellEntry(row, col, formulaOrValue);
  service.insert(cellFeedUrl, newEntry);
  out.println("Added!");
}