1. 去 https://pypi.python.org/pypi/xlrd/0.9.2下載xlrd-0.9.2.tar.gz
2. 解壓縮安裝,筆者用的macos,直接python setup.py install
3 . 使用範例:
import xlrd book = xlrd.open_workbook(fn) #多少个sheet print "The number of worksheets is", book.nsheets #每个sheet的名字 print "Worksheet name(s):", book.sheet_names() #得到第0个sheet sh = book.sheet_by_index(0) for rx in range(sh.nrows): values = sh.row(rx) for value in values: print value.ctype, value.value #type(number, text), value