Importing Datasets into Your Project
How to Import Datasets into Your Project
Open the website with the data you need to download. Here, we’re downloading data on ramen noodle ratings from Kaggle.
Download the file:
Unzip it:
Open Google Sheets and create a new blank doc:
Click
File -> Import
:Click
Upload -> Select a File From Your Device
:Choose the file you need and click
Select
. This will open the import settings window, which lets you adjust these options:- Actions with the current spreadsheet. Ours is empty, so select
Replace spreadsheet
. - Data separator type. In this example, the cells in the file are separated by commas. If there were semicolons, you’d want to choose
Custom
and type a semicolon. - We don’t need to convert text, so select
No
.
- Actions with the current spreadsheet. Ours is empty, so select
The data has been imported:
Press
(Ctrl + S)
to save the file. Name it and click*Save
.Make the file accessible to anyone with the link:
Click
Copy Link
in the next window to copy the link to the table. Click*Done
. The link you copied should look something like this:https://docs.google.com/spreadsheets/d/10WseQm5aVrqo52eCS8RmjAQ9kFEFvNjBnrR3W820o5Q/edit?usp=sharing
This part of the link is the spreadsheet ID:
10WseQm5aVrqo52eCS8RmjAQ9kFEFvNjBnrR3W820o5Q
. Copy it and use it in the next step.Place this code into Jupyter notebook:
1from io import BytesIO2import requests34spreadsheet_id = '<GOOGLE_SPREADSHEET_ID>'5file_name = 'https://docs.google.com/spreadsheets/d/{}/export?format=csv'.format(spreadsheet_id)6r = requests.get(file_name)7df = pd.read_csv(BytesIO(r.content))8dfReplace with the spreadsheet ID from the previous step and run the code.
The result: