def remove_lead(customer_list, customer_id):
wb = openpyxl.load_workbook(filename=excel_file)
ws = wb['data']
for row in ws.iter_rows(min_row=2, max_col=4):
for cell in row:
if cell.value == None or cell.column == 'B' or cell.column == 'C' or cell.column == 'D':
continue
elif cell.column == 'A' and str(cell.value) == customer_id:
cell_row = str(cell.row)
cell.value = None
ws['B' + cell_row].value = None
ws['C' + cell_row].value = None
ws['D' + cell_row].value = None
break
wb.save(filename=excel_file)
# Remove selected lead from excel sheet
for customer in customer_list:
if customer['Id'] == customer_id:
customer_list.pop(customer_list.index(customer))
return customer_list
excel.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录