Mounting Google Drive in Google Colab with 3 mouse clicks

This article follows on from my previous one; Accessing Google Drive and creating your first Python script in Google Colab — A complete beginners walkthrough:

So you’re getting to grips with Google Colab because you can’t wait to use it’s completely free GPU on this awesome free cloud service based on Jupyter Notebooks. Working with this fantastic tool has thrown some curveballs which I’ve had to research and then found an easier way to “skin this cat”. One of them was how to mount my Google Drive so I could access my data-files.

You’ve probably already read many articles which explains how to mount your Google Drive so I’ll just skim over this first…

Using the import statement:

Simply click on the blue link, select your Google e-mail address from the list and click on ‘Allow’. Copy the code (you can select the two overlapping rectangles to copy the code) and hit Ctrl + C (cmd + C on Mac) to copy it to the clipboard. Paste it into the ‘Enter your authorisation code:’ and you’re done.

Your Google Drive has been successfully mounted. Good, but Colab can do one better, using 3 mouse clicks and no code!

Firstly, click the folder icon at the bottom (hovering your mouse over this shows ‘Files’) of the list of icons on the left-hand-side

A message will appear stating ‘Connecting to a runtime to enable file browsing’:

Click on the right-most icon (hovering your mouse over this displays ‘Mount Drive’):


Your Google Drive should now show as being mounted:

Click on the folder ‘MyDrive’ to drill down into you Google Drive directory.

NOTE: You will have to perform this quick action action every time your runtime session ends.

Computer Scientist with an interest in AI

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