from openpyxl import Workbook from openpyxl import load_workbook wb=load_workbook(r'F:\funn.xlsx') colA = wb['Sheet1']['A'][1:] colT = wb['Sheet2']['A'][1:] for cell in colA: [空格] for i in colT: [空格][空格] if i.value==cell.value: [空格][空格][空格] wb["Sheet1"]['K'][(cell.row)-1].value=wb['Sheet2']["D"][(i.row)-1].value