我想根据电子表格中的标题仅提取特定列。 我尝试了以下代码
ListQuery query=new ListQuery(url);
query.setFields("FieldName");
但它会出现以下错误:
Exception in thread "main" com.google.gdata.util.InvalidEntryException: Bad Request
Fields query parameter is not supported
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:602)
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.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:1077)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:676)
at com.google.gdata.client.Service.query(Service.java:1237)
at com.google.gdata.client.Service.query(Service.java:1178)
我们是否可以通过使用ListQuery或url来获取特定列而不是listfeed,或者是否有其他方式
答案 0 :(得分:0)
如果您使用Visualization Query Language
,则可以选择列选择大页面的B和C(第2和第3)的示例(来自this tutorial): https://docs.google.com/a/temet.ch/spreadsheets/d/1jwKyiVro8ZqPr5jRsyCN7igPJ76vOvtRy_xq3I8nKVI/gviz/tq?tqx=out:html&gid=0&tq=select%20B,C
如果您遗漏tqx=out:html
参数,查询将返回JSONP,但您不会获得ListEntries。
请注意,列名是工作表的原生A,B,C ......,它不会像ListFeed
那样使用第1行中的标题。
答案 1 :(得分:0)
http://gdata-java-client.googlecode.com/svn/trunk/java/sample/spreadsheet/list/ListDemo.java
但我觉得" CellFeed"在几乎所有方面都更好。
如果您想要做的只是"阅读"还有一些其他选择。数据