# HTML Table to Excel & CSV: Web Page Tables to Sheets (`adhistory/html-tables-to-excel`) Actor

HTML table to Excel converter at $1.50 per 1,000 tables. Paste web page links and get every table as rows keyed by its header, one Excel file per page (one sheet per table) and a CSV per table. Merged cells and two-row headers handled.

- **URL**: https://apify.com/adhistory/html-tables-to-excel.md
- **Developed by:** [Brandon Ob](https://apify.com/adhistory) (community)
- **Categories:** Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 table extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## HTML Table to Excel & CSV: convert web page tables to spreadsheets

This HTML table to Excel converter takes links to public web pages and returns every data table on them as rows keyed by the table's header, plus **one Excel file per page (one sheet per table)** and **one CSV per table**. Two-row headers become clean column names ("Q1 revenue"), merged cells (rowspan/colspan) are filled in so filters work, footnote markers like `[1]` are removed, and numbers like `1,250`, `$12.99` or `7.5%` arrive as real numbers in Excel. You pay per table delivered: $1.50 per 1,000 tables, nothing for pages that fail or have no tables.

### What does HTML Table to Excel & CSV do?

- Finds **every `<table>` on a web page**, in page order, and skips menus, navigation boxes, infoboxes and layout tables (you can turn that off).
- Converts each one to **Excel and CSV**: an `.xlsx` workbook per page with one sheet per table (frozen header row), a CSV per table, and the rows as JSON in the dataset.
- Labels each table with its **caption, or the heading above it** ("Selected Interest Rates", "Head of household"), and names the Excel sheet after it.
- Handles **merged cells**: a value that spans rows or columns is repeated in every cell it covers, so each row stands on its own. You can turn that off.
- Joins **two-row headers** (`Q1` over `units` and `revenue`) into `Q1 units`, `Q1 revenue`, and moves a title row merged across the whole table into a `title` field.
- Removes hidden text (sort keys, `display:none`) and **footnote markers** like `[1]` or `[a]`, so values stay clean.
- Turns plain numbers, prices and percentages into numbers in Excel; IDs with leading zeros, dates and phone numbers stay as text.
- Lists pages that could not be loaded, and pages with no data tables, in a `SUMMARY` record.

### Use cases

- **Analysts and researchers:** pull rate tables, statistics and rankings from government, central bank and reference pages into Excel without copy-paste.
- **Finance and pricing teams:** track exchange-rate, tax-bracket, fee or price tables that sites publish as HTML; schedule a run and diff the CSVs.
- **Marketers and SEO teams:** export comparison tables, pricing tables and lists from competitor or partner pages.
- **Journalists and students:** turn tables in articles and public reports into data you can sort, chart and cite.
- **Developers and no-code builders:** add a "web table to rows" step to a pipeline and send it to Google Sheets, Airtable or a database, as an IMPORTHTML alternative that works for many pages at once.

### Website table to Excel: download tables from any web page

Copying a table from a website into Excel usually means selecting it by hand, fixing merged cells and retyping numbers that paste as text. Paste the page link here instead: each data table on the page comes back as its own Excel sheet and CSV file, named after its caption or the heading above it, with numbers stored as numbers. It works the same for one page or a few hundred, and a saved task can re-download the same website tables every day.

### How to convert an HTML table to Excel

1. Open the Actor and paste web page links, one per line. Each page must load without a login.
2. Optional: turn off **Skip layout and navigation tables** to get every `<table>`, or raise **Minimum data rows** to skip small tables.
3. Click **Start**. Open the **Tables** view, or use the `excelUrl` link for one spreadsheet per page.
4. To refresh a table regularly, save the input as a task and schedule it, or call the Actor from the API, Make, Zapier or n8n.

Try it first with the word `sample` (a built-in example page with three tables, a menu and a navigation box).

### Input

| Field | What it does |
|---|---|
| `pageUrls` | Web page links, one per line. `sample` runs the built-in example. |
| `firstRowIsHeader` | Use the header row(s) as column names (default on). |
| `repeatMergedCells` | Copy a merged cell's value into every cell it spans (default on). |
| `skipLayoutTables` | Skip menus, navigation boxes, infoboxes, layout and single-column tables (default on). |
| `keepFootnoteMarks` | Keep markers like `[1]` inside cells (default off). |
| `minRows` | Skip tables with fewer data rows than this (default 2). |
| `maxItems` | Stop after this many tables (default 200). |

```json
{
  "pageUrls": ["sample", "https://www.federalreserve.gov/releases/h15/"],
  "firstRowIsHeader": true
}
```

### Output

One dataset item per table. From the default input:

| pageUrl | table | heading | rowCount | columns |
|---|---|---|---|---|
| sample | 1 | Wholesale price list | 6 | SKU, Product, Unit, Price (USD), Stock |
| sample | 2 | Quarterly sales by region, 2026 | 4 | Region, Q1 units, Q1 revenue, Q2 units, Q2 revenue, Growth |
| sample | 3 | Support rota | 3 | Team, Name, Shift, Phone |
| federalreserve.gov/releases/h15/ | 1 | Selected Interest Rates | 38 | Instruments, then one column per day |
| irs.gov/.../federal-income-tax-rates-and-brackets | 1 | 2025 tax rates for a single taxpayer | 7 | Tax rate, on taxable income from, up to |

```json
{
  "pageUrl": "sample",
  "pageTitle": "Sample page with tables (HTML Table to Excel demo)",
  "table": 3,
  "tablesOnPage": 3,
  "heading": "Support rota",
  "title": "Support rota, week 47",
  "columns": ["Team", "Name", "Shift", "Phone"],
  "rowCount": 3,
  "columnCount": 4,
  "rows": [
    {"Team": "Sales", "Name": "Ana Ruiz", "Shift": "08:00-16:00", "Phone": "+1 555 0100"},
    {"Team": "Sales", "Name": "Ben Okafor", "Shift": "12:00-20:00", "Phone": "+1 555 0101"},
    {"Team": "Support", "Name": "Chen Wei", "Shift": "08:00-16:00", "Phone": "+1 555 0102"}
  ],
  "csvUrl": "https://api.apify.com/v2/key-value-stores/.../records/01-sample-tables-table-03.csv",
  "excelUrl": "https://api.apify.com/v2/key-value-stores/.../records/01-sample-tables.xlsx",
  "extractedAt": "2026-11-20T09:15:00+00:00"
}
```

"Sales" is one cell with `rowspan="2"` on the page; it comes back on both rows. The "Support rota, week 47" row spanned the whole table, so it became the `title` and the real header row was used.

### Pricing

Pay per result: **$1.50 per 1,000 tables** ($0.0015 per table), with no start fee. Pages that fail or contain no data tables are free. Set a maximum cost per run and the Actor stops cleanly at it. A run with the default input costs about one and a half cents.

### Limits

- **Tables in the page HTML only.** Tables that a site draws with JavaScript after the page loads, and "tables" built from `<div>`s, are not read. Such pages are listed in `SUMMARY` and not charged.
- **Public pages only.** Pages behind a login, paywall or bot challenge (HTTP 401/403) are reported as failed; the Actor does not get around them. Some large sites block automated requests altogether.
- Only the text in each cell is kept, not colours, links or images.
- Pages up to 15 MB. Each link is read as it is; the Actor does not follow pagination or crawl other pages.
- For tables in files use the sibling tools below: PDF, Word, images, invoices, bank statements and payslips.

### FAQ

**How do I convert an HTML table to Excel without copy-paste?** Paste the page link into this Actor and download the `excelUrl` workbook: every table is its own sheet with the header row frozen. It works for any number of pages at once.

**Can it get all tables on a web page at once?** Yes. Every data table becomes a separate dataset item, CSV file and Excel sheet, in the order they appear. Turn off "Skip layout and navigation tables" if you also want menu and layout tables.

**Is this an IMPORTHTML alternative for Google Sheets?** Yes. IMPORTHTML takes one table per formula and breaks on merged cells; this Actor returns every table on many pages, with merged cells filled. Send the rows to a sheet with [Google Sheets Export & Import](https://apify.com/adhistory/google-sheets-export-actor), or point IMPORTDATA at the `csvUrl`.

**What happens to merged cells and two-row headers?** Merged values are written into every cell they covered, and stacked headers are joined into one name per column, so the sheet is ready for filters and pivot tables.

**Why did a page return no tables?** Most often the table is drawn by JavaScript after the page loads, so it is not in the HTML the server sends. The `SUMMARY` record lists such pages; you are not charged for them.

**Am I charged for pages that failed?** No. Only delivered tables are charged; failures are listed in `SUMMARY`.

### Related tools

- [PDF Table to Excel & CSV](https://apify.com/adhistory/pdf-tables-to-excel): tables from PDF files, joined across page breaks.
- [Word Table to Excel & CSV](https://apify.com/adhistory/word-tables-to-excel): tables from .docx files and shared Google Docs.
- [Image Table to Excel & CSV](https://apify.com/adhistory/image-tables-to-excel): tables from screenshots, photos and scans.
- [Invoice PDF to Excel & CSV](https://apify.com/adhistory/invoice-pdf-to-excel): invoice numbers, totals and line items from invoice PDFs.
- [Bank Statement PDF to Excel & CSV](https://apify.com/adhistory/bank-statement-to-excel): transactions and balances from bank statements.
- [Google Sheets Export & Import](https://apify.com/adhistory/google-sheets-export-actor): send the rows straight into a Google Sheet.
- [Website Screenshot API](https://apify.com/adhistory/website-screenshot-api): full-page screenshots of the same pages.

Found a bug or need a feature? Open an issue on the Issues tab — I usually reply within a day.

# Actor input Schema

## `pageUrls` (type: `array`):

Links to public web pages that contain HTML tables, one per line. Pages behind a login, and tables drawn by JavaScript after the page loads, are not read. Enter the word sample to try a built-in example page.

## `firstRowIsHeader` (type: `boolean`):

Use each table's header row (its <th> rows, or the first row) as column names. Two-row headers are joined, e.g. 'Q1 revenue'. Turn off to get Column 1, Column 2 and so on.

## `repeatMergedCells` (type: `boolean`):

A merged cell's value (rowspan/colspan) is copied into every row and column it spans, so filters and pivot tables work. Turn off to keep it only in the first cell.

## `skipLayoutTables` (type: `boolean`):

Skip tables used for page layout, menus, navigation boxes and infoboxes, and single-column tables. Turn off to get every <table> on the page.

## `keepFootnoteMarks` (type: `boolean`):

Keep footnote markers such as \[1] or \[a] inside cells. Off by default, so values like '1,250\[3]' arrive as clean numbers.

## `minRows` (type: `integer`):

Skip tables with fewer data rows than this (small layout tables, single-row boxes).

## `maxItems` (type: `integer`):

Stop after this many tables. You are charged per table delivered.

## Actor input object example

```json
{
  "pageUrls": [
    "sample",
    "https://www.federalreserve.gov/releases/h15/",
    "https://www.irs.gov/filing/federal-income-tax-rates-and-brackets",
    "https://www.federalreserve.gov/releases/h10/current/"
  ],
  "firstRowIsHeader": true,
  "repeatMergedCells": true,
  "skipLayoutTables": true,
  "keepFootnoteMarks": false,
  "minRows": 2,
  "maxItems": 200
}
```

# Actor output Schema

## `tables` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "pageUrls": [
        "sample",
        "https://www.federalreserve.gov/releases/h15/",
        "https://www.irs.gov/filing/federal-income-tax-rates-and-brackets",
        "https://www.federalreserve.gov/releases/h10/current/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("adhistory/html-tables-to-excel").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "pageUrls": [
        "sample",
        "https://www.federalreserve.gov/releases/h15/",
        "https://www.irs.gov/filing/federal-income-tax-rates-and-brackets",
        "https://www.federalreserve.gov/releases/h10/current/",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("adhistory/html-tables-to-excel").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "pageUrls": [
    "sample",
    "https://www.federalreserve.gov/releases/h15/",
    "https://www.irs.gov/filing/federal-income-tax-rates-and-brackets",
    "https://www.federalreserve.gov/releases/h10/current/"
  ]
}' |
apify call adhistory/html-tables-to-excel --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,adhistory/html-tables-to-excel"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ReWvfSWNHcVWTKSg9/builds/4Y0MYb2SehAjb8lj7/openapi.json
