How can I open an Excel file in Python

Try the xlrd library.

From what I can see from your comment, something like the snippet below might do the trick. I’m assuming here that you’re just searching one column for the word ‘john’, but you could add more or make this into a more generic function.

xlrd description

Extract data from Excel spreadsheets (.xls and .xlsx, versions 2.0 onwards) on any platform. Pure Python (2.7, 3.4+). Strong support for Excel dates. Unicode-aware.


Working with Excel Files in Python

This site contains pointers to the best information available about working with Excel files in the Python programming language.

The Packages

There are python packages available to work with Excel files that will run on any Python platform and that do not require either Windows or Excel to be used. They are fast, reliable and open source:


The recommended package for reading and writing Excel 2010 files (ie: .xlsx)


An alternative package for writing data, formatting information and, in particular, charts in the Excel 2010 format (ie: .xlsx)

Download | Documentation | GitHub


This package is for reading data and formatting information from older Excel files (ie: .xls)


This package is for writing data and formatting information to older Excel files (ie: .xls)


This package collects utilities that require both xlrd and xlwt, including the ability to copy and modify or filter existing excel files.
NB: In general, these use cases are now covered by openpyxl!
5/5 - (3 votes)