How can I authorize gspread when i cannot share my sheet to the service account client_email?

Viewed 333

I am trying to use gspread to access some sheets at work.

I followed all the steps here -> https://gspread.readthedocs.io/en/latest/oauth2.html

However, I am stuck in this step:

  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.

Since I'm doing this with my company's Gsuite account, I cannot share my sheet with "external domain".

Below is the message that I get when I try to share my sheet with the service account.

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.

I am afraid the security guys will be bothered to whitelist this just for me, so i need to find my way around it.

With R, there is no problem accessing my sheet with the 'googlesheets4' package.

I can simply run sheets_auth() to get a popup window that lets me log in with my Gsuite account.

Is there any way that I can do this with gspread? Seems like there used to be gspread.login('xxxx@xxx.com','password') option before (Which no longer works).

0 Answers
Related