合并/取消合并单元格
合并单元格时,除左上角以外的所有单元格都将从工作表中删除。为了携带合并单元格的边界信息,合并单元格的边界单元格被创建为MergeCells,其值始终为None。有关格式化合并单元格的信息,请参见样式化合并单元格。
from openpyxl.workbook import Workbook
wb = Workbook()
ws = wb.activews.merge_cells(‘A2:D2’)
ws.unmerge_cells(‘A2:D2’)or equivalently
ws.merge_cells(start_row=2, start_column=1, end_row=4, end_column=4)
ws.unmerge_cells(start_row=2, start_column=1, end_row=4, end_column=4)
来源:CSDN
作者:weixin_42530610
链接:https://blog.csdn.net/weixin_42530610/article/details/103863591