Skip to content

Commit

Permalink
Update src/tablib/formats/_xlsx.py
Browse files Browse the repository at this point in the history
Co-authored-by: Hugo van Kemenade <[email protected]>
  • Loading branch information
andrewgy8 and hugovk authored Jan 20, 2025
1 parent f4277f3 commit 2999501
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/tablib/formats/_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ def _adapt_column_width(cls, worksheet, width):
if width == "adaptive":
for row in worksheet.values:
for i, cell in enumerate(row):
cell = str(cell)
cell_width = len(str(cell))
if len(column_widths) > i:
if len(cell) > column_widths[i]:
column_widths[i] = len(cell)
if cell_width > column_widths[i]:
column_widths[i] = cell_width
else:
column_widths.append(len(cell))
column_widths.append(cell_width)
else:
column_widths = [width] * worksheet.max_column

Expand Down

0 comments on commit 2999501

Please sign in to comment.