def read_sheets_from_xls(file_path):
workbook = xlrd.open_workbook(file_path)
sheets = []
for sheet in workbook.sheets():
if sheet.ncols <= 0:
continue
cells = []
for y in range(0, sheet.nrows):
# ??????
all_empty = True
for v in sheet.row_values(y):
if v != '':
all_empty = False
break
if all_empty:
continue
text = sheet.cell_value(y, 0)
# ?????
if isinstance(text, unicode) and text.startswith('//'):
continue
cells.append(sheet.row(y))
if len(cells) > 0:
sheets.append((sheet.name, cells))
return sheets
评论列表
文章目录