```yaml
product: AlterLab
title: "Table Parsing — Web Scraping Glossary | AlterLab"
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/glossary/table-parsing
```

extraction

# Table Parsing

Table parsing extracts structured rows and columns of data from HTML `<table>` elements, converting them into arrays, dataframes, or other tabular formats.

HTML tables encode information in a nested structure of `<tr>` (row), `<th>` (header cell), and `<td>` (data cell) elements. Libraries like BeautifulSoup, pandas `read_html`, and Scrapy selectors can traverse this structure and return the contents as a two-dimensional array.

Complications arise from tables that use `colspan` and `rowspan` attributes to merge cells across multiple rows or columns. Parsing these correctly requires tracking span state across rows to align data with the right column header. Some pages also nest tables inside other tables for layout purposes, requiring the scraper to target the correct table by position, class, or caption text.

Pandas `pd.read_html(url)` is a common shortcut that downloads a page and returns all detected tables as DataFrames with a single call, handling most span logic automatically. For more complex tables or JavaScript-rendered ones, BeautifulSoup or browser-based extraction is needed.

### What is Table Parsing?

Table parsing extracts structured rows and columns of data from HTML `<table>` elements, converting them into arrays, dataframes, or other tabular formats.

### How does AlterLab handle Table Parsing?

Pandas `pd.read_html(url)` is a common shortcut that downloads a page and returns all detected tables as DataFrames with a single call, handling most span logic automatically. For more complex tables or JavaScript-rendered ones, BeautifulSoup or browser-based extraction is needed.

## Examples

```
# pandas: extract all tables from a page
import pandas as pd

tables = pd.read_html("https://example.com/data")
first_table = tables[0]
print(first_table.head())
```

## Related Terms

[Data ExtractionThe process of identifying and pulling specific fields from raw web content, converting unstructured HTML into typed JSON records.](https://alterlab.io/glossary/data-extraction)[Structured Data ExtractionConverting free-form HTML into typed JSON records using explicit schemas, producing clean structured output instead of raw markup.](https://alterlab.io/glossary/structured-data-extraction)[BeautifulSoupA Python library for parsing HTML and XML and navigating the parse tree using CSS selectors or tag methods.](https://alterlab.io/glossary/beautifulsoup)[CSS SelectorA pattern used to match HTML elements by tag, class, ID, or attribute, used in web scraping to extract specific nodes from parsed HTML.](https://alterlab.io/glossary/css-selector)[XPathXML Path Language — a query syntax for selecting nodes in HTML or XML using path expressions, more expressive than CSS selectors for complex traversals.](https://alterlab.io/glossary/xpath)

## Extract Table Parsing data from any website

AlterLab returns clean, structured data from any public URL — no scraper infrastructure needed. Start free, no credit card required.

[View API docs](https://alterlab.io/docs/api/rest)

[Back to Glossary](https://alterlab.io/glossary)