Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/tablib/formats/_xls.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ def dset_sheet(cls, dataset, ws):
for i, row in enumerate(_package):
for j, col in enumerate(row):

# Convert large ints to str to avoid XLS float precision loss
# (XLS uses 64-bit floats: precision is limited to ~15 digits)
if isinstance(col, int) and not isinstance(col, bool):
if abs(col) > 9007199254740991: # 2^53 - 1
col = str(col)

# bold headers
if (i == 0) and dataset.headers:
ws.write(i, j, col, bold)
Expand Down
Loading