fix: xlsx cell parsing, now returning values instead of formulas (#2520)

* fix: xlsx doc parsing, now returning values instead of formulas

Signed-off-by: glypt <8trash-can8@protonmail.ch>

* fix: add test for better coverage of xlsx backend

Signed-off-by: glypt <8trash-can8@protonmail.ch>

* fix: add the total of ducks as a formula in the tests/data

This also adds the test that the value 310 is contained in the table.
Without the fix from the previous commit, it would return "B7+C7"

Signed-off-by: glypt <8trash-can8@protonmail.ch>

---------

Signed-off-by: glypt <8trash-can8@protonmail.ch>
This commit is contained in:
glypt
2025-10-29 11:35:51 +01:00
committed by GitHub
parent b6c892b505
commit d9c90eb45e
6 changed files with 291 additions and 15 deletions

View File

@@ -139,10 +139,14 @@ class MsExcelDocumentBackend(DeclarativeDocumentBackend, PaginatedDocumentBacken
self.workbook = None
try:
if isinstance(self.path_or_stream, BytesIO):
self.workbook = load_workbook(filename=self.path_or_stream)
self.workbook = load_workbook(
filename=self.path_or_stream, data_only=True
)
elif isinstance(self.path_or_stream, Path):
self.workbook = load_workbook(filename=str(self.path_or_stream))
self.workbook = load_workbook(
filename=str(self.path_or_stream), data_only=True
)
self.valid = self.workbook is not None
except Exception as e: