top of page
  • Writer's pictureEmily Wakowski

How to read excel datasheets from Python

Sometimes your company has a lot of data and you want to transfer it say from an excel file to python so that you can use it.

Excel has certainly dominated as a proprietary software for basic data analysis for many years.However, with the momentum created by open source softwares: you can now easily manipulate data faster, with more control and elegantly all for free(provided you have basic programming skills)!

Enter Python! A non proprietary software that allows you to achieve just that and much much more!! So in the next few paragraphs i’ll show you how to move your data — no matter how large to python.

Choose a Suitable Environment

Python scripts have to run in special environments or most recently specialized data science or python IDE’s. If you are new to python i have suggestion to use this IDE HERE

First lets import pandas

import pandas as pd

Pandas is a python library that has useful functions that can help you save your data in data frames (similar to rows and columns in excel), and other data analysis functions written by others!!

Reading the data from excel to python

We then read our excel sheet from our computer directory, we can even dig down to the sheet we want to import to python

mydataframe = pd.read_excel('C:/spandex/Desktop/mydata.xlsx', sheet_name='Sheet1'

(If using windows be careful with the forward slashes as python is very strict with these)

Checking if your data has been transferred


Type the variable mydataframe and press enter. We can now see what is in our dataframe:

Now the data is ready for manipulation and further data analysis!

28 views0 comments


Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page