Repository navigation
Description
Describe the bug
After upgrading unstructured from 0.16.0 to 0.16.1 and later, partition_xlsx returns a Table element whose string representation no longer preserves stable row boundaries.
In 0.16.0, str(Table) allowed deterministic reconstruction of header and row groupings by splitting on double newlines.
Starting in 0.16.1, the same XLSX file produces a flattened string where rows are no longer clearly separated, which breaks header to value reconstruction logic that previously worked reliably.
This change appears related to the whitespace or HTML minification updates introduced around 0.16.1.
To Reproduce
Install two versions separately and run the same code against the same XLSX file.
from unstructured.partition.xlsx import partition_xlsx
from unstructured.documents.elements import Table
import io
def inspect_xlsx(path):
with open(path, "rb") as f:
file_content = io.BytesIO(f.read())
elements = partition_xlsx(file=file_content)
print("Element count:", len(elements))
for i, el in enumerate(elements):
print("Type:", type(el))
if isinstance(el, Table):
print("---- STRING OUTPUT START ----")
print(str(el))
print("---- STRING OUTPUT END ----")
inspect_xlsx("sample.xlsx")Observed difference:
0.16.0
Row groupings are preserved in a way that allows:
rows = str(table).split("\n\n")to produce logical rows.
0.16.1 and later
str(table) appears flattened, producing a single continuous block such as:
1 1 0 www.example.com 2 2 0 www.example2.com ...
Double newline row separation is no longer reliable.
Expected behavior
Either:
- The string representation of
Tablefor XLSX remains backward compatible and preserves stable row boundaries,
or
- A documented, stable API is provided to extract structured row and column data from the
Tableelement without relying on whitespace formatting ofstr(Table).
The previous behavior allowed deterministic header extraction and key value reconstruction. That is no longer possible using the same logic.
Screenshots
If helpful, attach:
• Output of str(Table) using 0.16.0
• Output of str(Table) using 0.16.1 or 0.16.10
Highlight that the row grouping changed.
Environment Info
Python version: 3.12
unstructured versions tested:
0.16.0 works as expected
0.16.1 fails to preserve row boundaries
0.16.10 exhibits same behavior as 0.16.1
OS: macOS
Please let me know if additional environment details are required.
Additional context
Downstream logic depends on reconstructing header to value mappings for simple sheets by:
- Treating first row as headers
- Aligning subsequent rows positionally
- Emitting Header colon Value formatted text
This logic worked reliably until 0.16.0.
If relying on str(Table) for row separation is not supported behavior, guidance on the correct structured extraction method for XLSX tables would be appreciated.
Activity
[-]bug/<short-name>[/-][+]bug/XLSX Table string representation loses row boundaries after 0.16.0 causing flattened output from partition_xlsx[/+]ai-mountain commentedon Feb 27, 2026
Hi, maintainers.
I’m interested in contributing to this issue. As a new contributor, I’d appreciate your confirmation before starting.
onefixoneline commentedon Mar 8, 2026
If you're tired of library updates breaking your table reconstruction logic, I've built a stable API that guarantees clean JSON output for complex tables. Check it out: https://rapidapi.com/morriseverley/api/developer-first-invoice-parsing-api
fix: restore row boundaries in Table.text (fixes Unstructured-IO#4235)
digitalpromptmarket-beep commentedon Mar 28, 2026
This is a really common pattern we're seeing: extraction tools work great for clean, standard documents but struggle with edge cases — mixed formats, non-standard fields, scanned content, or complex layouts.
The problem: you can't build a single extractor that handles 100% of real-world variation without hallucinating on unseen patterns.
The fix: extraction + verification. Extract with your tool of choice (Unstructured, Textract, LLMs, etc.), then validate the output against the source document. This is fast and cheap because you're only validating the fields you actually extracted, not re-processing the whole document.
We built a verification API (DocQA) exactly for this use case. It takes your extracted structured data + the source document and returns:
Cost is $0.05-$0.50 per verification. Let me know if you want to test it on your problematic documents.
Full disclosure: I built this tool.