close

How to use Python to read one column from Excel file?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to use Python to read one column from Excel file in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to use Python to read one column from Excel file?

  1. How to use Python to read one column from Excel file?

    If you're not locked with xlrd I would probably have used pandas instead which is pretty good when working with data from anywhere:

  2. use Python to read one column from Excel file

    If you're not locked with xlrd I would probably have used pandas instead which is pretty good when working with data from anywhere:

Method 1

If you’re not locked with xlrd I would probably have used pandas instead which is pretty good when working with data from anywhere:

import pandas as pd

df = pd.ExcelFile('location/test.xlsx').parse('Sheet1') #you could add index_col=0 if there's an index
x=[]
x.append(df['name_of_col'])

You could then just write the new extracted columns to a new excel file with pandas df.to_excel()

Method 2

You can get the values of the 8th column like this:

for rownum in range(sheet.nrows):
    x.append(sheet.cell(rownum, 7))

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read