1

I have a script which to be ran, needs to read a file located within my Google Drive, and also authenticate to be able to read a Google Sheet. Is there a few to update my script, so that I don't need to go through the authentication process each time I run the script?

from google.colab import drive
drive.mount('/content/drive')
!ls "/content/drive/My Drive/service_account.json"

from google.colab import auth
auth.authenticate_user()
import gspread
from oauth2client.client import GoogleCredentials
gc = gspread.authorize(GoogleCredentials.get_application_default())

After running each of these, I have to authenticate via the "Go to this URL in a browser:" pop up.

Any help would be appreciated, thanks!

JackNesbitt
  • 125
  • 1
  • 7

0 Answers0