def excel_parser(file = 'test.xlsx', sheel_name = 'Sheet1'):
data = load_workbook(file)
table = data[sheel_name]
print('%-22s %-22s %s' % (table['A1'].value, table['B1'].value, table['C1'].value))
#print(table.rows)
row_location = 0
for row in table.iter_rows():
if row_location == 0:
row_location += 1
continue
else:
cell_location = 0
for cell in row:
if cell_location == 0:
print('??:%-20s' % cell.value, end='')
cell_location += 1
elif cell_location == 1:
print('??:%-20s' % cell.value, end='')
cell_location += 1
elif cell_location == 2:
print('??:%-20s' % cell.value, end='')
cell_location += 1
print()
row_location += 1
评论列表
文章目录