Writing "inf" silently creates invalid workbook

Issue #932 resolved
Joshua Arnott created an issue

The following code will run without exception, but creates an invalid workbook. This is caused because Excel does not appear to have a representation of infinity. The same problem occurs when trying to write a numpy.inf value. I'm not sure what the correct behavior is here: either raise an exception, or write "inf" as a string.

import openpyxl
wb = openpyxl.Workbook()
sheet = wb.create_sheet("Test")
sheet["A1"] = float("inf")

Tested on openpyxl 2.4.8 and 2.5.0b1, both installed via anaconda/conda-forge.

Comments (2)

  1. Log in to comment