Downloading Data into Google Colab

Amit Kumar Garg
Blog By Abnormal Doctors
3 min readJun 24, 2020

An easy guide to upload the data, or downloading the data into Google Colab

Uploading the data to Colab is same as downloading the data into colab

There are many steps for uploading the data into the colab, but I prefer different methods depending upon the uploads

  1. Upload directly in the Colab
  2. Mounting the Google drive
  3. Downloading the data into the Colab

1. Uploading data directly into the Colab

Click on the red marked icon and you can upload the data after clicking this

Click on this icon and you can upload there

2. Mounting the data from the google drive:

Clicking on this drive icon you can upload the data

3. Downloading the data into the Colab

You can use the following bash code to download the file into the Colab

a) !wget

!wget <url>

It will download the data into the google colab working directory which is /content/<your file>

b) !curl

!curl <cURL> -o <name you want to give to your file.extension>

here- o is used to give output to the file, otherwise the system gonna crash because it will display the file in the same terminal

How, to get the cURL of the download file, let me show you an example below by showing a download from Kaggle

First, go to the website where download link is present

Now press F12 in your browser, the below window will appear on the right hand side you can see the Network option

When you click on download button near the Train.zip, you will see some changes in the network console

Now you can see a process in name of that file. Right click on it

As you right click on it, you will copy it as cURL(bash)

and paste with the bash command of !curl as described above

If it is a zip file, you can unzip the file and store in your required directory of Colab

!unzip <your downloaded file path> <path to where you want to unzip>

For uploading small files around 50 MB or less, I prefer direct upload

for uploading larger files, consider downloading or mounting google drive

--

--

Amit Kumar Garg
Blog By Abnormal Doctors

Building CARPL.AI | Research Fellow IIT Delhi | MBBS AIIMS, New Delhi | AI enthusiast | Aspiring physician-scientist | Rookie Biodesigner |