Read Data From Google Sheets using Python

Google Sheets is an online spreadsheet service from Google that lets you create spreadsheets in the cloud. Reading Google Sheets is different from reading a Microsoft Excel or CSV file using Python. So in this article, I’m going to walk you through how to read data from Google Sheets using Python for Data Science.

You can easily create a spreadsheet in Google Sheets, it is very same as Microsoft Excel spreadsheets. For this task, you need to have a spreadsheet on Google Sheets that you can create or upload an Excel file to Google Sheets.

Read Data From Excel Sheets using Python

Reading data from Google Sheets is not possible in an IDE or a code editor in our systems. For this task, you need to use Google Colab, another service from Google for creating Jupyter notebooks. You must have used Google Colab for any data science project before.

Also, Read – 200+ Machine Learning Projects Solved and Explained.

To read a dataset from Google Sheets, I’ll be using a dataset that’s already uploaded to my Google Sheets. So let’s see how to connect Google Colab to Sheets:

After running the code above, you will get a link in the output which is nothing but the authentication process to get the code you need to connect Google Colab with Sheets.

Google sheets with Python

Just click on the link as shown above and you will be taken to your authentication code. Copy this code and paste it into the text box as shown above and hit enter.

Final Step: Using Python Pandas

You’ve connected Google Colab to Sheets, now let’s see how to read Google Sheets using Python for data science using Pandas library in Python:


So here’s how to read any dataset from Google Sheets using Python. If you implement this code in an IDE or code editor, you will get errors, so only use this method in Google Colab.

I hope you liked this article on how to read data from Google Sheets with Python programming language. Feel free to ask your valuable questions in the comments section below.

Default image
Aman Kharwal

Coder with the ❤️ of a Writer || Data Scientist | Solopreneur | Founder


  1. Can I use the above code on Anaconda Jupyter notebook or anaconda command prompt?

Leave a Reply

Data Science | Machine Learning | Python | C++ | Coding | Programming | JavaScript