Sign in

I came across multiple solutions to access files from Google drive in Colab notebooks asking to install wrappers or utilities and what not.

However, accessing files from Google drive can be done just with these 2 lines of code:

from google.colab import drivedrive.mount('/content/drive')

This will generate a url in Colab, click that, which will open up a new tab, choose your Google account, allow access. This will generate a token, copy that and paste back in the blank field in Colab.

After the drive has been mounted follow the next step.

Now to access files from drive: prefix this …

Ruth Forsyth

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store