[英]How to read spreadsheet which made public using Java with google api?
I want to read the data from one of the public spreadsheet which is in pubhtml. 我想从pubhtml中的一个公共电子表格中读取数据。
How can I read above spreadsheet using google-api? 如何使用google-api阅读上述电子表格?
I already tried following steps but getting an error: 我已经尝试了以下步骤,但出现错误:
I used google API doc with my spreadsheet id. 我将Google API文档与电子表格ID一起使用。
Example: 例:
sheet-id- 2PACX-1vTe- Cmpii1CsnufmSER7ObEuhBb4TGO29RRwcEAQjW8PYkHKQMfUvriPk2LPXyCm8HMKCIvNFXSqJkU
Exception in thread "main" com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found { "code" : 404, "errors" : [ { "domain" : "global", "message" : "Requested entity was not found.", "reason" : "notFound" } ], "message" : "Requested entity was not found.", "status" : "NOT_FOUND" } at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1065) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469) at Quickstart.main(Quickstart.java:108) Process finished with exit code 1
Does anyone know what's wrong? 有人知道怎么了吗?
Make sure you're providing the correct spreadsheetID
. 确保您提供正确的
spreadsheetID
。 Error implies there's no spreaddsheet found. 错误表示找不到电子表格。
You can use this spreadsheets.values.get Try-it to validate that. 您可以使用电子表格sheets.values.get进行尝试来验证这一点。 If it gives off the same error, it means you need to recheck your
spreadsheetID
. 如果发出同样的错误,则意味着您需要重新检查
spreadsheetID
ID。
This is what a spreadsheetID looks like: 这是一个电子表格 ID的样子:
https://docs.google.com/spreadsheets/d/1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps/edit#gid=0
spreadsheetID : 电子表格ID :
1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps
1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.