Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Drive API Required after 5.11.0 #1277 #1286

Closed
lathonez opened this issue Sep 4, 2023 · 3 comments
Closed

Google Drive API Required after 5.11.0 #1277 #1286

lathonez opened this issue Sep 4, 2023 · 3 comments

Comments

@lathonez
Copy link

lathonez commented Sep 4, 2023

After 5.11.0 (and I assume #1277), I needed to enable the Google Drive API on my project in order to open a google sheet (using any mechanism).

The error was very helpful:

gspread.exceptions.APIError: {'code': 403, 'message': 'Google Drive API has not been used in project 7575758011 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=7575758011 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.', 'errors': [{'message': 'Google Drive API has not been used in project 7575758011 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=7575758011 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.', 'domain': 'usageLimits', 'reason': 'accessNotConfigured', 'extendedHelp': 'https://console.developers.google.com'}], 'status': 'PERMISSION_DENIED', 'details': [{'@type': 'type.googleapis.com/google.rpc.Help', 'links': [{'description': 'Google developers console API activation', 'url': 'https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=7575758011'}]}, {'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'SERVICE_DISABLED', 'domain': 'googleapis.com', 'metadata': {'consumer': 'projects/7575758011', 'service': 'drive.googleapis.com'}}]}

But it threw me. I was making a fully unrelated code change and I couldn't figure out why I'd suddenly need to enable Google Drive API. Took me a while to track it back to this PR.

From the context, it looks like #1277 is fixing a bug, and I probably should have had Google Drive API enabled the whole time.

I'm just raising this for others / in case you think it would be helpful to document the change.

@alifeee
Copy link
Collaborator

alifeee commented Sep 4, 2023

Hi. Thanks for this issue :) - it is something I clearly did not anticipate when implementing #1277.

Technically, our documentation says you should enable both Drive API and Sheets API. However, I can see how many people (probably myself included) would skim over it and miss out the step of enabling Drive API.

#1277 means that opening a spreadsheet now requires the Drive API as it uses it to get the metadata for "last edited time" and "created time" for the spreadsheet. Please follow the paper trail in #1277 for why we changed it to be that way. If you would have attempted to access either of these properties, you would've also come across this error (no Drive API access).

I'm just raising this for others / in case you think it would be helpful to document the change.

Thank you very much! I can see others also having this issue. We will leave this issue open for a while so it can more easily be found.

I have also added this information to the release notes

@alifeee alifeee pinned this issue Sep 4, 2023
@lathonez
Copy link
Author

lathonez commented Sep 6, 2023

Thanks for taking the time to reply and update the docs, and for the work maintaining this repo.

@alifeee
Copy link
Collaborator

alifeee commented Sep 6, 2023

Hi. With the new patch, you should not need Drive API access.

https://github.com/burnash/gspread/releases/tag/v5.11.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants