I\'ve been trying to write a script to copy formatting from one workbook to another and, as anyone dealing with openpyxl knows, it\'s a big script. I\'ve gotten it to work
The attributes you are looking for are inside the column_dimensions and row_dimensions attributes of the Worksheet object.
These are bound dictionaries whose values are ColumnDimension/RowDimension objects. The specific attribute you're looking for is ColumnDimension.hidden.
The following will print the column letter of all hidden columns in worksheet ws:
for colLetter,colDimension in ws.column_dimensions.items():
if colDimension.hidden == True:
print(colLetter)
And for rows:
for rowNum,rowDimension in ws.row_dimensions.items():
if rowDimension.hidden == True:
print(rowNum)
As I understand it, loading your workbook as read_only can mess with ws.row_dimensions, so be careful in this case.