欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

python openpyxl 获取合并的单元格列表,筛选解除单元格合并

程序员文章站 2022-06-14 09:11:12
...

        for i in ws.merged_cell_ranges:
            flag_index = False
            s = str(i).strip(string.uppercase)
            #if ... flag = True
            if flag_index:
                r1, r2, c1, c2 = i.min_row, i.max_row, i.min_col, i.max_col
                ws2.unmerge_cells(start_row = r1, end_row = r2, start_column = c1, end_column = c2)