#!/usr/bin/env python
# --*-- coding:utf8 --*--
# Author:Zhangbb


import openpyxl
import os


wb1 = openpyxl.load_workbook(r'/home/wzr/音乐/leili.xlsx')
wb2 = openpyxl.load_workbook(r'/home/wzr/音乐/wait_del.xlsx')
sh1 = wb1['xinqu']
sh2 = wb2.active

name_list = []

col_list = [ col for col in sh2.columns]
for cell in col_list[1]:
    if cell.value != "姓名":
        name_list.append(cell.value)

for i in name_list:
    print(i, end="   ")
print()

for i in range(2, sh1.max_row+1):
    if sh1[f"B{i}"].value in name_list:
        print(f"离职人员:", sh1[f"B{i}"].value)
        sh1[f"N{i}"] = "离职人员"
        print(f"N{i} value: ", sh1[f"N{i}"].value)

wb1.save(r'/home/wzr/音乐/leili.xlsx')

wait_del.xlsx中保存的是已离职人员名单,leili.xlsx中保存的是区域所有员工名单,现在需要在总表中统计信息, 手工输入麻烦, 就写了这个小脚本, 目的是在离职人员对应行上标注“离职人员”字样