【问题标题】:Manipulating single cell in a google spreadsheet在谷歌电子表格中操作单个单元格
【发布时间】:2014-07-20 21:02:18
【问题描述】:

因此,对于我为我的朋友编写的应用程序,我需要与 google drive 和 google data api 交互,以便在 google 电子表格中创建文件夹和操作数据。

现在提前查看 API,一切看起来都非常简单。 直到您真正开始并发现您可能在 Internet 上找到的所有文档都已被弃用。

最终我在互联网上一段时间后弄清楚了大部分内容(例如身份验证和创建新文件夹/复制文件等) 到目前为止一切顺利。

但是现在我遇到了以下问题: 我正在尝试操纵一个单元格(实际上是多个单元格,但 1 比 1),经过 2 天浏览谷歌的残暴文档后,我转向了你们。

我已经验证了我的用户,甚至从电子表格中读取了值,但是我似乎无法写入它。

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

这是我从他们的代码示例中得到的,但是 service.insert() 返回错误

 Exception in thread "main" com.google.gdata.util.ServiceException: Internal Server Error
Internal Error

at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:632)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
at com.google.gdata.client.Service.insert(Service.java:1409)
at com.google.gdata.client.GoogleService.insert(GoogleService.java:613)

我真的希望这里有人可以帮助我,我很绝望,谷歌在这方面不是我的朋友(谷歌也没有自己的文档)

  • A.E.

【问题讨论】:

  • 我可以证明 Google 的 API 文档经常不完整或完全错误的说法。一个“技巧”是尝试使用可以实际阅读代码并尝试从那里构建的 Python 版本。
  • 您为什么使用 Google-Apps-Script 标签。?根本不相关。

标签: java google-data-api


【解决方案1】:

我自己想通了,

正如我在其中一个 cmets 中已经说过的,我将值 0 传递给变量 col,将其传递给 google 服务器给了我一个错误。

更改正在调用的循环:

 new CellEntry(row,col, "value");

从 1 开始而不是 0 固定它。

  • AE

【讨论】:

  • 谢谢!我花了 2 个小时才弄清楚内部服务器错误实际上意味着:“GOOGLE 电子表格不是基于零的”:)。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-28
相关资源
最近更新 更多