from openpyxl import load_workbook
document = load_workbook("huge_bug.xlsx")
# hide column AJ
document.active.column_dimensions["AJ"].hidden = True
# save workbook
document.save("huge_bug_2.xlsx")
I want to hide column AJ but both columns AJ and AK get hidden and I have no idea why. There is no merged cell that could indicate why those two columns "work together".
The problem might be from my initial excel file, but I'm not sure where to look; however it does look like an openpyxl problem because it doesn't occur with VBA.
I'm using openpyxl 3.0.10 and Python 3.11.1.
As @moken pointed out on SO, it probably has to do with the "fill" of the columns, if you change one of them, only by one point, the bug is not reproducible anymore.
Here is a MRE. Download huge_bug.xlsx first:
I want to hide column
AJ
but both columnsAJ
andAK
get hidden and I have no idea why. There is no merged cell that could indicate why those two columns "work together".The problem might be from my initial excel file, but I'm not sure where to look; however it does look like an openpyxl problem because it doesn't occur with VBA.
I'm using
openpyxl 3.0.10
andPython 3.11.1
.As @moken pointed out on SO, it probably has to do with the "fill" of the columns, if you change one of them, only by one point, the bug is not reproducible anymore.