def load_excel():
wb = openpyxl.load_workbook(filename=excel_file)
ws = wb['data']
# Parse data from Excel file
dict_list = []
keys = {'A': 'Id', 'B': 'Full Name', 'C': 'Email', 'D': 'Phone'}
for row in ws.iter_rows(min_row=2, max_col=4):
d = {}
for cell in row:
if cell.column == 'A' and cell.value == None:
break
elif cell.column != 'A' and cell.value == None:
d[keys[cell.column]] = ''
else:
d[keys[cell.column]] = str(cell.value)
if len(d.keys()) != 0:
dict_list.append(d)
return dict_list
# Update lead in excel worksheet and working dictionary
# Removing from excel leaves a blank row in the excel
excel.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录