Access google docs using gspread

I am trying to access google docs using the gspread utility, I was successful when I tried to use the code below in my google doc

import gspread g = gspread.login('gmailID', 'password') worksheet = g.open('GoogleSheetName').get_worksheet(0) val = worksheet.cell(2, 1).value print val 

But when I tried the same code for my corporate account that uses google server, I get below the error:

  raise AuthenticationError("Unable to authenticate. %s code" % ex.code) gspread.exceptions.AuthenticationError: Unable to authenticate. 500 code 

Can anyone help me with this?

+4
source share
1 answer

See what gspread author says here :

Two factors of authorization

If your Google account is secured with Two Factor Authorization, you need to create a password for the application and use your email address to log in as usual.

Otherwise, you get AuthenticationError: unable to authenticate. 403 when trying to log in.

0
source

All Articles