for column_cells in worksheet.columns:
    length = max(len(as_text(cell.value)) for cell in column_cells)
worksheet.column_dimensions[column_cells[0].column].width = length
openpyxl - adjust column width size