← ClaudeAtlas

document-table-extractionlisted

Extract structured data from HTML tables, PDFs, spreadsheets and scanned documents. Use whenever the user needs data out of a PDF, a table on a web page, a spreadsheet, a datasheet, an annual report, a price list, or a scanned document, or mentions OCR, tabula, camelot or table parsing.
manypicom/web-data-skills · ★ 0 · Data & Documents · score 72
Install: claude install-skill manypicom/web-data-skills
# Table and Document Extraction A large share of the most valuable public data — registry filings, price lists, specifications, statistical releases, annual reports — is published as a table or a PDF because that's what a human wanted to read. Both are solvable. The mistake is treating them the same, because a PDF has no structure to recover and an HTML table has plenty. ## HTML tables HTML tables carry real structure. Use it rather than reading cell text positionally. ```python import pandas as pd # Fastest path: pandas reads every table on a page tables = pd.read_html(html, flavor="lxml") print(f"{len(tables)} tables found") for i, t in enumerate(tables): print(i, t.shape, list(t.columns)[:5]) ``` That handles well-formed tables. The three things that break it, all common: **1. Merged cells.** `colspan` and `rowspan` shift every subsequent cell. Pandas mostly handles it; manual parsing usually doesn't. **2. Header rows that aren't `<th>`.** Many tables use styled `<td>` for headers, so the first data row becomes the column names. ```python # Detect and fix: if the first row looks like labels, promote it if all(isinstance(c, int) for c in tables[0].columns): t = tables[0] t.columns = t.iloc[0] tables[0] = t[1:].reset_index(drop=True) ``` **3. Layout tables.** Older sites use tables for page layout. A "table" with two rows and no header is probably a navigation bar. Filter on shape before assuming it's data. ```python def looks_like_data(t, min_row