def extract_excel(filename):
ret_string = ''
book = xlrd.open_workbook(filename)
sheets = book.sheet_names()
for sheet in sheets:
worksheet = book.sheet_by_name(sheet)
num_rows = worksheet.nrows - 1
num_cells = worksheet.ncols - 1
curr_row = -1
while curr_row < num_rows:
curr_row += 1
row = worksheet.row(curr_row)
curr_cell = -1
while curr_cell < num_cells:
curr_cell += 1
# Cell Types: 0=Empty, 1=Text, 2=Number, 3=Date, 4=Boolean, 5=Error, 6=Blank
cell_type = worksheet.cell_type(curr_row, curr_cell)
cell_value = worksheet.cell_value(curr_row, curr_cell)
ret_string += cell_value+'\n'
return ret_string
# Given a big long string of text, split it by newline and try matching stuff in it.
mail_parser2json_extract.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录