gspread/OAuth2: authenticated default gmail accoun

2019-08-08 18:34发布

问题:

I have been using gspread (authenticated via ClientLogin) for a last year. Now I would like to use OAuth2. I've followed tutorial from gspread site: http://gspread.readthedocs.org/en/latest/oauth2.html

The problem is that this method creates new "Email address" (in console.developers.google) which doesn't have an access to spreadsheets - all spreadsheets should be shared again. This is really difficult if you have 1000+ spreadsheets.

The question is: how to authenticated with OAuth2 my default gmail account (that I've been using to access via ClientLogin)?

Thank you!

EDIT:

I've followed this tutorial: http://www.indjango.com/access-google-sheets-in-python-using-gspread/

But I modified code from point 1.2: http://www.indjango.com/access-google-sheets-in-python-using-gspread/#comment-2026863410

Result - some spreadsheets are available, some not and I have no idea why (same entries in access list)...

回答1:

It seems that code from EDIT works. Thus, this is working solution:

I've followed this tutorial: http://www.indjango.com/access-google-sheets-in-python-using-gspread/

But I modified code from point 1.2: http://www.indjango.com/access-google-sheets-in-python-using-gspread/#comment-2026863410

The only problem is that Google Sheets API returns only 500 results (thus, if using gspread when you have more spreadsheets that are not among results -> gspread raises SpreadsheetNotFound).