From Faster Than 20
Accessing Data Via API
- Enable link sharing. Recommended path for consumers and domains that allow publishing out. Spreadsheets shared to anyone who has the link can view don’t require credentials. If a document is visible to unauthenticated users, no code changes are necessary.
- Use OAuth. For cases where link sharing isn’t a viable solution, requesting end-user credentials can be done with minimal code. Specifically, developers must change their code to pass in an OAuth 2.0 credential authorized for the Google Sheets API scope, as documented in the Google Charts API developer guide.
- Use a server-side proxy. One popular use case for Sheets is to power an internal intranet site with a Google Sheet. In this case, asking the user for explicit auth is burdensome, and link sharing may not be viable. We recommend that the developer set up a server-side proxy that caches the spreadsheet contents without sending any auth credentials to the client.