docling-project / docling-project/docling

Difficulty Extracting Nested Tables Within Table Cells

Open
#1,613 1 comment 0 reactions 1 assignee Claimed by @cau-git View on GitHub
enhancement
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug

When extracting content from the attached PDF (_table_inside_cell.pdf_) using Docling, I encountered a table that contains another table inside one of its cells. In the extracted output (_docling-table_inside_cell.md_), it appears that nested tables using the Markdown | syntax are not supported, likely due to Markdown language limitations.

Possible approaches to representing nested tables could include:

- Embedding an HTML table inside a Markdown table cell (if supported)
- Placing the nested table outside the main table
- Using another format or notation

However, I am not sure what the ideal or expected output should be in this scenario.

### Steps to reproduce

1. Run Docling on the attached _table_inside_cell.pdf_.
2. Review the output.
3. Observe how the nested table is (or is not) represented.

```
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions, TableFormerMode
from docling.document_converter import DocumentConverter, PdfFormatOption

def extract_data_with_docling(input_data_path):
pipeline_options = PdfPipelineOptions(do_table_structure=True)
pipeline_options.table_structure_options.mode = TableFormerMode.ACCURATE

doc_converter = DocumentConverter(
allowed_formats=[InputFormat.PDF, InputFormat.IMAGE],
format_options={
InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
},
)

result = doc_converter.convert(input_data_path)
markdown_content = result.document.export_to_markdown()
print(markdown_content)

extract_data_with_docling("PDF PATH")
```

### Docling version

Docling version: 2.31.0
Docling Core version: 2.28.1
Docling IBM Models version: 3.4.1
Docling Parse version: 4.0.0

### Python version

Python 3.10.11

[docling-table_inside_cell.md](https://github.com/user-attachments/files/20299392/docling-table_inside_cell.md)
[table_inside_cell.pdf](https://github.com/user-attachments/files/20299393/table_inside_cell.pdf)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.