I tried to look for it but couldn't find one. Is there a possibility to adjust the width,height of cells in excel in mm or cm dimensions using openpyxl or xlwt modules? if yes then can someone point me to the commands for scripting? thanks a lot.
With Openpyxl
To set column width:
#setting width of column B to 12.25
sheet.column_dimensions['B'].width = float(12.25)
To set Row height:
#setting height of row 3 to 33.75
sheet.row_dimensions[3].height = float(33.75)
Hiding Columns and Rows
Using the dimensions we can also hide rows and columns:
#Hiding Column B
sheet.column_dimensions['B'].hidden = True
And with rows
#Hiding Row 3
sheet.row_dimensions[3].hidden = True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With