XLSXToDocument drops literal NA and N/A cell values
XLSXToDocument turns text cells containing NA or N/A into empty output cells. These can be real values, such as a region code or an explicit status. Once the converter has emitted the Document, the original text cannot be recovered.
A small workbook with this sheet reproduces it:
| Code | Status |
|---|---|
| NA | OK |
| N/A | pending |
from io import BytesIO
from openpyxl import Workbook
from haystack.components.converters.xlsx import XLSXToDocument
from haystack.dataclasses import ByteStream
book = Workbook()
sheet = book.active
sheet.append(["Code", "Status"])
sheet.append(["NA", "OK"])
sheet.append(["N/A", "pending"])
data = BytesIO()
book.save(data)
content = XLSXToDocument().run([ByteStream(data.getvalue())])["documents"][0].content
print(repr(content))
# ',A,B\n1,Code,Status\n2,,OK\n3,,pending\n'I ran this twice on main; both outputs were identical. Markdown output also leaves the two cells blank. The converter uses pd.read_excel without overriding pandas' default NA-string parsing. Passing read_excel_kwargs={"keep_default_na": False} avoids the loss, but users have to know to opt out before converting the workbook.
Could the converter preserve literal text values by default while still keeping truly blank cells empty? A similar loss in the CSV preprocessing components is tracked in #12784, but this is the XLSX converter's separate read_excel path. I can prepare a focused patch and tests if you'd like one.
Source: deepset-ai/haystack