Nested Tables - How a Table Inside a Cell Is Handled
A nested table is a `<table>` placed inside another table's cell. Older layouts used them heavily. When you extract data, the inner table's text should not be flattened into the outer cell; each table is better read on its own.
Why it matters
Nested tables are a relic of pre-CSS web design. Before flexbox and CSS grid, designers used tables for layout and sometimes embedded small tables inside cells for structure or data. You'll find them in legacy HTML emails, old financial reports, and archived websites.
If you naively flatten a nested table's content into the outer cell, you lose the inner table's structure. The outer table's row might become a sprawling mess of concatenated values. A smarter approach is to extract each table as its own candidate, keep the outer summary, and let you choose what you need.
How it works
When Scalpel Tables detects a table inside another table's cell, it:
- Reads the outer table normally, skipping any descendant tables when collecting cell text
- Reports each inner table as a separate candidate table in the list
- Marks the outer table with a badge showing how many nested tables it found
The inner table's content doesn't leak into the outer cell text. The outer cell stays focused on its own content. Both tables are available to export.
This applies at any depth. A table inside a table inside a table is handled the same way: each table is extracted separately.
What does not matter
Nested tables don't break the extraction. The detector handles them gracefully. You're not losing data by skipping the inner table's text in the outer cell; the inner table is always listed on its own card so you can export it directly.
Also, the nesting doesn't change how the inner table is processed. If the inner table has a header row, it's detected as normal. Merged cells in the inner table are handled the same way as they would be in a non-nested table.
Code example
An outer table with a product list, where one cell holds a detailed specs table:
<table>
<thead>
<tr><th>Product</th><th>Details</th></tr>
</thead>
<tbody>
<tr>
<td>Widget Pro</td>
<td>
<table>
<tr><td>Colour</td><td>Blue</td></tr>
<tr><td>Weight</td><td>500g</td></tr>
</table>
</td>
</tr>
</tbody>
</table>
Scalpel Tables extracts two candidates:
- Outer table: Product, Details (with the inner table's content skipped)
- Inner table: Colour, Blue; Weight, 500g
Each can be exported separately. You can keep both or discard the one you don't need.
How Scalpel Tables shows it
The outer table card shows a "nested 1" badge (or the count if more than one). Click any table card to see it highlighted on the page. The inner tables appear as their own separate cards in the list, marked with their own badges if they have special properties.
Related: