Hi, i got some problem like this,
the unmerge function got really weird result in my cases, when it leave some cell merged, and even merge some of the cell that is not previously merge?
Here is my code:
def remove_merged_cells(working_sheet):
# [print(merged) for merged in merged_ranges]
for cell_group in list(working_sheet.merged_cells.ranges):
min_col, min_row, max_col, max_row = range_boundaries(str(cell_group))
top_left_cell = working_sheet.cell(row=min_row, column=min_col).value
working_sheet.unmerge_cells(str(cell_group))
# Set the value for each cell in the unmerged range
for row in working_sheet.iter_rows(min_col=min_col, min_row=min_row, max_col=max_col, max_row=max_row): #add 1 to max row to try to get notes columns
for cell in row:
cell.value = top_left_cell
return working_sheet
Here is the list of merged cell i printed out from openpyxl detection:
C30:C31
J13:J14
C18:C23
G13:G14
H32:H36
H13:H15
C16:C17
C13:C15
G9:J9
B18:B23
B37:J37
B10:J10
C32:C36
E9:F9
J16:J17
J26:J27
F13:F14
H16:H17
B25:B29
I13:I14
B32:B36
G38:J38
B30:B31
E13:E15
H30:H31
H18:H23
H25:H29
B13:B15
C25:C29
D13:D15
B16:B17
F16:F17
The % production(or weight per bag) supposed to be the same, but it merge, and then the Date required and quantity is also lost due to merging :/
As you can see, it detect the ranges just fine, but when i try to do unmerge, it even merge the cell, can someone point out where i code wrong, thanks