#!pip install Pydrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
#Authentication happens only once and
# a file adc.json is created once authentication is done.
file_id = "1nBBfiZOoZToCaGsLxU3s_FRcFcg0Swkk" #ID OF YOUR GDRIVE FILE.
#THE ID IS PART BETWEEN ..../d/ AND /view...............
# https://drive.google.com/file/d/1nBBfiZOoZToCaGsLxU3s_FRcFcg0Swkk/view?usp=sharing
downloaded = drive.CreateFile({"id": file_id})
downloaded.GetContentFile("MyFile.csv")
No comments:
Post a Comment