我使用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