If any of the cells in a row is non-empty, any() return false, so it is returned immediately. When you want to set a font with OpenPyXL, you will need to import the Font class from openpyxl. Prerequisites : Excel file using openpyxl writing | reading Set the height and width of the cells: Worksheet objects have row_dimensions and column_dimensions attributes that control row heights and column widths.sheets # Get the dimensions of the dataframe.
Openpyxl row_dimensions Iterate the rows with iter_rows().