How to download Kaggle datasets directly into Google Collab?

One day, I tried to download the dataset from Kaggle and my laptop got hanged. This is because of the large size of the dataset. After that, the first thing that came to my mind was how to directly import my dataset into google collab without downloading it on my laptop. A simple answer to the question is mentioned below in 5 magical steps-:

Part 1 -: Open your Kaggle account > Click on your profile pic on the right side > Click on Account.

Part 2 -: Afterwards, go to the API section and Click on the “Create New API Token” Heading. This will download a file named “Kaggle.json”.

Part 3: Now, open New Notebook in Google Collab and follow these steps!

Step 1-: Write this command in the first cell. This will allow you to access the Kaggle API

Step 2-: Afterwards, type this command in the next cell, this will allow you to import the “Kaggle.json” file in google collab.

Step 3-: Now, create the next cell and write the following command in it to copy the API token in the created kaggle directory

However, in order to access or see the “Kaggle.json” file. Just click on the Files icon on the left side > Under sample_data (Note, this is an inbuilt folder, every data automatically get store under this folder) you will see the kaggle.json file.

Step 4-: At last to download the dataset from Kaggle to google collab, first open the dataset of your choice in Kaggle. Then copy the API command of the dataset.

Again open the notebook, and in the next cell paste the API Code. This will download your dataset into google collab.

However, your dataset will be stored automatically under the sample_data folder in the form of a “zip” file.

Step 5-: At the last, to unzip the file, simply run the following code in the next cell.

The unzipped file named “cumulative.csv” has been stored under the same folder named “sample_data”.

Now, your data is ready to use. Let's start coding !!!!!!!