1 # 边框线 2 border_set = Border(left=Side(border_style='thin', color='000000'), 3 right=Side(border_style='thin', color='000000'), 4 top=Side(border_style='thin', color='000000'), 5 bottom=Side(border_style='thin', color='000000')) 6 7 # 给第一列数据加边框 8 col = ws['A'] 9 for cell in col: 10 cell.border = border_set