我使用Python xlrd http://scienceoss.com/read-excel-files-from-python/从一个Excel工作表Python的xlrd数据提取
我的问题是,如果我读在Excel工作表第一单元为“员工姓名”一列中读取数据
还有名为另一行,其第一单元“员工姓名”
我们如何阅读的最后一列从最后一排,其在第一cell.Ignoring以前
wb = xlrd.open_workbook(file,encoding_override="cp1252")
wb.sheet_names()
sh = wb.sheet_by_index(0)
num_of_rows = sh.nrows
num_of_cols = sh.ncols
valid_xl_format = 0
invalid_xl_format = 0
if(num_of_rows != 0):
for i in range(num_of_rows):
questions_dict = {}
for j in range(num_of_cols):
xl_data=sh.cell(i,j).value
if ((xl_data == "Employee name")):
# Regardless of how many "Employee name" found in rows first cell,Read only the last "Employee name"
有“员工姓名” 10
给出的代码只是一个例子。无论如何谢谢你的解决方案... – Hulk 2010-09-23 17:54:21