Python Read Excel File Tutorial

Published On: 27/01/2023 | Category: Python

Hi Dev,

This article goes in detailed on how to extract data from excel using python. I explained simply about how to read excel file in python. This article goes in detailed on how to get data from excel file in python. Here you will learn how to read data from excel file in python.

Here, i will describe you of two example pandas and openpyxl to read and get excel file data in python.

I basically created demo.xlsx file in file put the three id, name and email row with content as like below, we will use same file for both example:

So let's see bellow example:

Example 1: Using Pandas
# import pandas library as pd
import pandas as pd
# get by default 1st sheet of demo excel file
data = pd.read_excel('demo.xlsx')
   ID             Name              Email
0   1   Bhavesh Sonagra   [email protected]
1   2   Nikhil Thumar     [email protected]
2   3   Piyush Kamani     [email protected]

Example 1: Using openpyxl
import openpyxl
# Define variable to load the dataframe
dataframe = openpyxl.load_workbook("demo.xlsx")
# Define variable to read sheet
data =
# Display Row Data
for row in range(0, data.max_row):
    for col in data.iter_cols(1, data.max_column):
Bhavesh Sonagra
[email protected]
Nikhil Thumar
[email protected]
Piyush Kamani
[email protected]

It will help you....