1st method
you can head into the dataset page and click on new notebook at the top right corner

2nd method
open any notebook and click on add data at the right menue

3rd method
not recommended, since each person that opens the ipynb will have to upload their own token first.
when using colab first download your kaggke json key and do the following steps
- create a kaggle key, you can go into your settings then head into the account tab and you can find a
create new tokenbutton in the api section, click on it to download your token.
- install the kaggle library
! pip install kaggle
- upload your kaggle key or you can put the following code to upload the key
from google.colab import files
files.upload()
- now you can download your dataset using the following code
!kaggle datasets download -d [user/data-name]
in our example here [user/data-name] is kukuroo3/body-performance-data

Download Kaggle Dataset by using Python - Stack Overflow
python 3.x - How to get datasets into kaggle - Stack Overflow
Trouble importing kaggle datasets
python - How to read file from Kaggle in Jupyter Notebook in Microsoft Azure? - Stack Overflow
Videos
Basically, if you want to use the Kaggle python API (the solution provided by @minh-triet is for the command line not for python) you have to do the following:
import kaggle
kaggle.api.authenticate()
kaggle.api.dataset_download_files('The_name_of_the_dataset', path='the_path_you_want_to_download_the_files_to', unzip=True)
I hope this helps.
kaggle api key and usersame is available on kaggle profile page and dataset download link is available on dataset details page on kaggle
#Set the enviroment variables
import os
os.environ['KAGGLE_USERNAME'] = "xxxx"
os.environ['KAGGLE_KEY'] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
!kaggle competitions download -c dogs-vs-cats-redux-kernels-edition
I am having a little trouble trying to import kaggle datasets. I have installed Anaconda and I have open a Jupyter note book. I run !pip install kaggle --upgrade and I get Requirement already up-to-date: kaggle in c:\users\..... and Requirement already satisfied, skipping upgrade: urllib3<1.23.0,>=1.15 in c:\users... Generally many reports saying that kaggle is installed and up graded. I have also followed the Kaggle API page here https://github.com/Kaggle/kaggle-api where I downloaded the kaggle.json with username / password and put it in the correct file path. My question is what do I do now, running something like import kaggle as kaggle or simply jumping straight into importing the data from kaggle.competitions import twosigmanews I get this error:
--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-1-d4a1406d9f46> in <module>() ----> 1 from kaggle.competitions import twosigmanews ModuleNotFoundError: No module named 'kaggle.competitions'
What are my next steps? what have I missed?
I think that the name of the competition is wrong. Try:
from kaggle.api.kaggle_api_extended import KaggleApi
api = KaggleApi('copy and paste kaggle.json content here')
api.authenticate()
files = api.competition_download_files("two-sigma-financial-news")
While looking through the source code, I found this class. I think the notebook doesn't auto authenticate when you call KaggleApi(), hence you need to call the authenticate function on the API to connect to the Kaggle API.
Try:
api = KaggleApi()
api.authenticate()
I was able to connect and download the samples after this call.