Created
July 19, 2020 13:36
-
-
Save sizhky/9ef26896ca6cb96110aa5325c31f5000 to your computer and use it in GitHub Desktop.
Mount a drive file in colab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!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