Reputation: 1741
Situation:
I have a Google Sheets whose data I would like to access using URL and an API key, e.g.:
https://sheets.googleapis.com/v4/spreadsheets/{SHEETS-ID}/values/{RANGE}?key={API-KEY}
This works only when the Sheet is publicly available, i.e. "Anyone with the link can view". I would like not to allow link sharing. I've seen in Apps Script that it is possible to add access to a service account.
Question:
Is this also possible if you only have an API key and requests the data using a URL as above?
Upvotes: 2
Views: 1611
Reputation: 2998
No, it's not possible to access private data only with an API key. As stated in the documentation :
If the request requires authorization (such as a request for an individual's private data), then the application must provide an OAuth 2.0 token with the request. The application may also provide the API key, but it doesn't have to.
Anyhow the Google Sheet API will make your life easier to build requests and retrieve private data.
Upvotes: 2