Skip to content

Instantly share code, notes, and snippets.

@sizhky
Created July 19, 2020 13:36
Show Gist options
  • Save sizhky/9ef26896ca6cb96110aa5325c31f5000 to your computer and use it in GitHub Desktop.
Save sizhky/9ef26896ca6cb96110aa5325c31f5000 to your computer and use it in GitHub Desktop.
Mount a drive file in colab
!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)
downloaded = drive.CreateFile({'id':"your_file_ID"}) # replace the id with id of file you want to access
downloaded.GetContentFile('your_file_name.csv') # replace the file name with your file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment