Skip to content Skip to sidebar Skip to footer

Google Sheets Api V4 For Reading Public Sheet With Less Steps

We would like to provide a list of reference from a public sheets that everyone can view in android. I tried the Quickstart sample from Google which works just fine. But we would

Solution 1:

If the Sheets are shared to "anyone with link" or "public", it might not be necessary to go through the account flow in Android. Choosing an account is mainly to get access to the right credentials, but public sheets can be read anonymously (without credentials) with the API.

Solution 2:

If you are still looking for an answer, only a single line replacement is needed for this to work:

Credentialcredential=newGoogleCredential().createScoped(SCOPES);

instead of

Credentialcredential= authorize();

then you can remove the method authorize() and the corresponding variables

Solution 3:

I found out there's a setKey method in com.google.api.services.sheets.v4.Sheets. For the third parameter in Builder, as credential, can be null. But will have error "Requests from this Android client application are blocked" if the Key restricted to Android.

Post a Comment for "Google Sheets Api V4 For Reading Public Sheet With Less Steps"