xlrd – t3h xls hottn3ss

on

Really great py module for reading .xls files. Instead of having to export excel to .csv and then parse, you can use this module to read/open/print info from whole excel files or from selected rows/cells. Research for this came about while trying to figure out at easier way to pull data from a particular portion of an excel sheet.

After you have installed xlrd the code is simple:


import xlrd
wb = xlrd.open_workbook('simple.xls')

wb.sheet_names()

sh = wb.sheet_by_index(0)
sh = wb.sheet_by_name(u'Sheet1')

for rownum in range(sh.nrows):
print sh.row_values(rownum)

Thanks to John Machin Author of:
http://pypi.python.org/pypi/xlrd/0.7.1

Leave a Reply

Your email address will not be published. Required fields are marked *