Querying column_dimensions can have unexpected behaviour
Created originally on Bitbucket by steven somersbury (Liam Sanders)
This could entirely be user error, but I wanted to check if a column has a custom width set, and if it does perform some action on it. See attached script.
What happens though is if the column does not have a custom width, then by querying column_dimensions["E"].customWidth, it correctly returns False but a column_dimension is created with all None/empty values which results in the final sheet having that column basically hidden.
I worked around it by checking if my column exists in column_dimensions.keys() but that seemed sort of counter intuitive.
I think it would be better if there was some way of querying if custom column/row attributes had been set that doesn't create an empty one in the process.
Attachments: example.xlsxopenpy.pyresult.xlsx