当我无法将我的工作表共享给服务帐户客户端时,如何授权gspread?

2024-06-16 11:09:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用gspread访问一些工作表

我遵循了此处的所有步骤->https://gspread.readthedocs.io/en/latest/oauth2.html

然而,我陷入了这一步:

  1. Go to your spreadsheet and share it with a client_email from the step above. Otherwise you’ll get a SpreadsheetNotFound exception when trying to access this spreadsheet with gspread.

由于我使用公司的Gsuite帐户进行此操作,因此我无法与“外部域”共享我的工作表

下面是我尝试与服务帐户共享我的工作表时收到的消息

Sorry, policy set by the administrators of ******* CO., LTD. prohibits the sharing of items with ****@****-269407.iam.gserviceaccount.com, because it is not a Google account in a compatible whitelisted domain.

我担心保安人员会费心为我把这个列入白名单,所以我需要找到解决办法

使用R,使用“googlesheets4”软件包访问我的工作表没有问题

我可以简单地运行sheets_auth()来获得一个弹出窗口,让我用我的Gsuite帐户登录

有没有办法让我用gspread来做这件事?似乎以前有gspread.login('xxxx@xxx.com','password')选项(不再有效)


Tags: ofthetoiocomwithreadthedocs步骤