Google Colab — Get data from Google Drive

Prashanth
2 min readSep 10, 2020

--

Step 1: Connect google colab to your gdrive.

Execute below code in colab:

from google.colab import drivedrive.mount(‘/content/gdrive’)

Go to the mentioned Link, which opens a page to choose the google account(select the account in which you have the data in Google drive) / login to desired google account.

Now it will prompt for access approval as below:

Click on ‘Allow’.

A page appears with authorization code as below:

Step 2: Copy this code and paste it in the output prompted cell, as below:

Press enter, now you will see a confirm message as bellow:

Congrats! Your Google Drive is mounted to this location /content/gdrive/My Drive/, Now we can directly access the drive files in our colab.

Step 3: Access the file as follow:

df=pd.read_csv(‘gdrive/My Drive/Colab Notebooks/DataSets_Kaggle/fer2013.csv’)

If you like this article give it some CLAPS and SHARE it with your friends, you can find more interesting articles here, follow me for more interesting techniques and concepts of Python/Data Science/Machine Learning. Keep learning :)

--

--