1

去年我一直在使用 gspread(通过 ClientLogin 验证)。现在我想使用 OAuth2。我已经按照 gspread 网站的教程进行操作:http: //gspread.readthedocs.org/en/latest/oauth2.html

问题是这种方法会创建新的“电子邮件地址”(在 console.developers.google 中),它无法访问电子表格 - 所有电子表格都应该再次共享。如果您有 1000 多个电子表格,这真的很难。

问题是:如何使用 OAuth2 对我的默认 gmail 帐户(我一直用来通过 ClientLogin 访问)进行身份验证?

谢谢!

编辑:

我遵循了本教程: http: //www.indjango.com/access-google-sheets-in-python-using-gspread/

但我从 1.2 点修改了代码:http: //www.indjango.com/access-google-sheets-in-python-using-gspread/#comment-2026863410

结果 - 一些电子表格可用,一些不可用,我不知道为什么(访问列表中的相同条目)......

4

1 回答 1

1

来自 EDIT 的代码似乎有效。因此,这是可行的解决方案:

我遵循了本教程: http: //www.indjango.com/access-google-sheets-in-python-using-gspread/

但我从 1.2 点修改了代码:http: //www.indjango.com/access-google-sheets-in-python-using-gspread/#comment-2026863410

唯一的问题是 Google Sheets API 仅返回 500 个结果(因此,如果在您有更多不在结果中的电子表格时使用 gspread -> gspread 会引发 SpreadsheetNotFound)。

于 2015-06-11T15:41:27.153 回答