2

I'm trying to read a bunch of spreadsheets within my organization that have been shared with my account and import the records into a database. I'd like to use OAuth2.0 instead of just using raw text passwords, but I'm having trouble getting this to work. My code right now is this:

scope = ['https://spreadsheets.google.com/feeds', 'https://docs.google.com/feeds']
credentials = SignedJwtAssertionCredentials('5***2@developer.gserviceaccount.com',SIGNED_KEY,scope)
gc = gspread.authorize(credentials)
print gc.openall()

This returns:

$ python read_sheets.py
[]

My account probably has a hundred spreadsheets shared with it, so I'm not sure why this is happening. One idea I had is that the service account email address doesn't have the sheets shared with it, but when I switch to the actual email address of the account, I get oauth2client.client.AccessTokenRefreshError: invalid_grant as an error. It seems like maybe I'm missing a step, but I've followed both the gspread instructions and the google oauth2 for service accounts and don't see what else I need to do. Appreciate the help

jpavs
  • 648
  • 5
  • 17

0 Answers0