colab import data from google drive code example

Example 1: connect google drive to colab

from google.colab import drive
drive.mount("/content/gdrive")

Example 2: read file from google drive colab

from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials

Example 3: how to import dataset from drive to colab

json_import = drive.CreateFile({'id':'29PGh8XCts3mlMP6zRphvnIcbv27boawn'})

json_import.GetContentFile('sample.json') - 'sample.json' is the file name that will be accessible in the notebook.

Tags:

Misc Example