Split out of the bilingual-contract table bloat work (branch claude/contract-table-bloat-v5wikg).
Problem
.xls/.xlsx are loaded with UnstructuredExcelLoader(filepath) (app/utils/document_loader.py:220) at its default mode. On the /text path the result is flattened into a single string, so a workbook arrives as one undifferentiated blob: no sheet names, no row boundaries, no column headers attached to the values beneath them.
Two consequences for legal use:
- Size. A large sheet is emitted in full with no structure to compress or chunk along — the same class of problem as the
.docx table padding, from a different loader.
- Usefulness. A damages schedule or a payment table loses the header-to-value association that makes it readable, so downstream extraction has to guess which number belongs to which column.
Suggested fix
- Consider
mode="elements" (as .rst already uses) or emitting one Document per sheet with the sheet name in metadata.
- Render each sheet as a compact pipe table with its header row, rather than free text — the same shape the
.docx path now produces.
- Bound the output: a 50,000-row sheet is not usefully extractable as text, and should say so rather than return 5 MB.
Needs a real-world sample workbook to size the work; the fix should be measured before/after the way the .docx change was.
Split out of the bilingual-contract table bloat work (branch
claude/contract-table-bloat-v5wikg).Problem
.xls/.xlsxare loaded withUnstructuredExcelLoader(filepath)(app/utils/document_loader.py:220) at its default mode. On the/textpath the result is flattened into a single string, so a workbook arrives as one undifferentiated blob: no sheet names, no row boundaries, no column headers attached to the values beneath them.Two consequences for legal use:
.docxtable padding, from a different loader.Suggested fix
mode="elements"(as.rstalready uses) or emitting oneDocumentper sheet with the sheet name in metadata..docxpath now produces.Needs a real-world sample workbook to size the work; the fix should be measured before/after the way the
.docxchange was.