Unmerged cells are still considered merged and cannot be written

Issue #1228 closed
Guillaume created an issue

When writing into a cell that used to belong to a merged cell, the application throws an error: AttributeError: 'MergedCell' object attribute 'value' is read-only

Sample Excel file contains a unique merged cell [A1:B2]

Error is displayed when the script tries to write into the previously merge cell 'B2' Worksheet.unmerge_cells(start_row=1, start_column=1, end_row=2, end_column=2) Worksheet.cell(2,2).value = "TOTO"

It seems that openpyxl still consider the cells as part of a merged cell.

Comments (5)

  1. Mohammed Muqtadir Mujtaba


    I am using latest openpyxl version (2.6.3) and when I try to write values in an excel file with merged cells, I am able to update one value at a time, and when I am using a for loop to update the merged cell value, I am getting the following error.

    “““AttributeError: 'MergedCell' object attribute 'value' is read-only”””

    I tried with the older version (2.5.14) , but there writing to merge cells is working fine but rendering of the borders of merge cells is not obtained properly..

    I tried downloading the source files from the repository , but still I am facing the same issue.

    Please Help..

  2. Log in to comment