Integrating Google Drive into Google Colab Notebooks

Why might we want to integrate Google Drive into Google Colab? The primary reason for this would be to easily access data files to use in your Colab notebooks. 

Here is a video that outlines the basic process. For written instructions, see below.

Integrating Google Drive into Google Colab is quite simple. The first step is to go to Google Colab, then open a new notebook.

Google Colab - Creating a new notebook

Next we want to open Files on the left-hand side and then click on the Google Drive icon.

Google Colab - opening Google Drive

Next you’ll get a pop-up window where you have to confirm that you want to connect to your Google Drive. 

Google Colab - Connect to Google Drive

If it’s the first time you’re doing this you’ll have to let Colab know which Google account you want to use. Just click on it.

Google Colab - Connect to a Specific Google Drive account

You’ll then have a new entry on the left in Files named “drive” that gives you full access to your Google Drive.

This is where the Google Drive files are

If you want to use a file in a program you’re writing in Colab, simply open the menu to the right of the file…

How to access the file path menu

…and click on “Copy path”.

Copy path

You can then paste the path into your notebook to use in a program, like this:

Using the path in a program

Leave a Reply