1.3 Colab

1.3.1 File Upload/Download

Colab offers you disk space for you to upload data and also to create new files. However, please note that these files will be deleted once your Colab session is closed!

There are several ways to upload/save data from your Colab session. Here are some options.

1.3.1.1 Option 1: Direct Colab Storage (Easiest)

You can upload files into directly into the drive of the ‘machine’ provided by Colab. Uploaded files will be stored in a folder named content

You can view the content in the Colab machine by clicking
View \(\rightarrow\) Table of Contents \(\rightarrow\) Files.

These files will be deleted once your Colab session is closed!

1.3.1.2 Option 2: Use your Google Drive (Preferred)

A better option is to link your Google Drive to your Colab session. To use this option:

  1. Run the following code Python code at the start of the session.
from google.colab import drive
drive.mount('/content/drive')
  1. You will then be able to access your files through the path /content/My Drive/

Other options

There are many other ways of transferring files into and from Colab. Please see here for more details.