0
votes

I want to read the data from one of the public spreadsheet which is in pubhtml.

How can I read above spreadsheet using google-api?

I already tried following steps but getting an error:

  1. I used google API doc with my spreadsheet id.

  2. Example:

sheet-id- 2PACX-1vTe-
Cmpii1CsnufmSER7ObEuhBb4TGO29RRwcEAQjW8PYkHKQMfUvriPk2LPXyCm8HMKCIvNFXSqJkU
  1. Error:
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?

1

1 Answers

0
votes

Make sure you're providing the correct spreadsheetID. Error implies there's no spreaddsheet found.

You can use this spreadsheets.values.get Try-it to validate that. If it gives off the same error, it means you need to recheck your spreadsheetID.

This is what a spreadsheetID looks like:

https://docs.google.com/spreadsheets/d/1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps/edit#gid=0

spreadsheetID:

1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps