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.
from xlrd import open_workbook
book = open_workbook('simple.xls',on_demand=True)
for name in book.sheet_names():
sheet = book.sheet_by_name(name)
# Attempt to find a matching row (search the first column for 'john')
rowIndex = -1
for cell in sheet.col(0): #
if 'john' in cell.value:
# If we found the row, print it
if row != -1:
cells = sheet.row(row)
for cell in cells:
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
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)
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!