# HTML Table Data Scraper (`min.h/html-table-data-scraper`) Actor

Extract public server-rendered HTML tables with merged cells and multi-row headers. Export normalized data to JSON and CSV.

- **URL**: https://apify.com/min.h/html-table-data-scraper.md
- **Developed by:** [Min. H](https://apify.com/min.h) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.80 / 1,000 html table row saveds

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 Data Scraper

Extract public server-rendered HTML tables with merged cells and multi-row headers. Export normalized data to JSON and CSV.

### Try the offline example

The prefilled input uses a bundled synthetic example. It makes zero target network requests and zero billing events. `examples/sample-input.json` contains the exact fixture input. `store/sample-output.json` is the observed fixture output, labeled `SYNTHETIC_FIXTURE`.

### Use permitted live targets

Provide up to 25 explicit HTTPS URLs you own or have permission to process. Hostnames are required. Remove credentials, query strings, explicit ports and fragments from user input. The per-target request and elapsed-time limits apply to DNS, robots, redirects and source reads. Redirects and source requests stay on the same HTTPS origin.

```json
{
  "mode": "live",
  "urls": [
    "https://www.w3.org/WAI/tutorials/tables/irregular/"
  ],
  "maxUrls": 1,
  "maxRows": 30,
  "timeoutSecs": 15
}
```

Demo basis: W3C WAI publishes teaching examples under its permissive-use notice; the robots rules allow the tutorial path. Live verification uses this page once.

Expands colspan and rowspan within row groups, including rowspan=0. Uses thead or a leading header-only row; joins multi-level headings and suffixes duplicates. Nested tables are separate. The flat dataset contains valuesJson; wide table CSV files are also written for spreadsheet use. JavaScript-rendered tables are outside the scope.

### Outputs

The Dataset, `OUTPUT.json` and `OUTPUT.csv` contain the same records. CSV protects spreadsheet formula-like strings with a leading apostrophe and uses empty cells for nulls. Read JSON for verbatim values. The grouped statuses are `COMPLETE`, `PARTIAL`, and `UNKNOWN`. `SUMMARY` reports coverage, duplicates, requests, response size and billing state. `PPE-AUDIT` contains only counts and safe response categories. Wide CSV files are stored as `TABLE-1.csv`, `TABLE-2.csv`, and so on in output order.

| Field | Meaning |
| --- | --- |
| `target` | Canonical supplied HTTPS target without credentials or query. |
| `source` | Execution source. |
| `status` | Coverage of the supplied target. Partial can contain valid rows. |
| `errorCode` | Safe failure code for an unreadable target. |
| `pageUrl` | Final same-origin page URL |
| `tableNumber` | Table ordinal on the source page |
| `rowNumber` | One-based data row within a table |
| `caption` | Table caption when present |
| `valuesJson` | JSON-serialized mapping of normalized headers to expanded cell values |

### Pay-per-event pricing

The rate is **$0.0008 per saved table row** using `html-table-row-saved`. A billable row is a usable, unique observation saved successfully across the result exports and Dataset. Synthetic, duplicate, failed and `UNKNOWN` rows are free. A PARTIAL target can include valid saved rows. Only those delivered unique observations count toward billing. UNKNOWN results and rows lost to failures are free. The run respects the lower of the platform and SDK caps. An indeterminate charge stops without resending the request. There are no automatic start or Dataset charges. Platform usage costs are included in the per-event price.

### Access and limitations

The Actor uses read-only public HTTPS without credentials, proxy bypass, account access or session cookies. It honors robots rules, rejects private DNS results and cross-origin redirects, validates TLS and keeps cloud inputs and storage restricted. Full-site crawling, page rendering and access-control bypass are unavailable. Confirm source terms and redistribution rights for your use case. Treat extracted text as untrusted input in any downstream AI system.

### Local development

Use Node.js 24. `npm ci`, `npm test`, and `npm run scan -- examples/sample-input.json ./sample-results` run locally. `npm start` supports the Apify SDK local `INPUT.json` storage convention. The local CLI does not charge PPE.

# Actor input Schema

## `mode` (type: `string`):

Use the fixed offline sample or read permitted live HTTPS targets.

## `urls` (type: `array`):

Enter up to 25 explicit public HTTPS URLs without credentials, query, explicit port or fragment. Use only targets you have permission to access.

## `maxUrls` (type: `integer`):

Maximum unique supplied targets visited in this run.

## `maxRows` (type: `integer`):

Maximum saved rows across live targets. Incomplete coverage is reported when limits are reached.

## `timeoutSecs` (type: `integer`):

Seconds allowed for DNS, robots, transfer and collection for each target.

## Actor input object example

```json
{
  "mode": "synthetic",
  "urls": [
    "https://example.com/"
  ],
  "maxUrls": 1,
  "maxRows": 10,
  "timeoutSecs": 8
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `json` (type: `string`):

No description

## `csv` (type: `string`):

No description

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

No description

## `audit` (type: `string`):

No description

## `firstTable` (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 = {
    "mode": "synthetic",
    "urls": [
        "https://example.com/"
    ],
    "maxUrls": 1,
    "maxRows": 10,
    "timeoutSecs": 8
};

// Run the Actor and wait for it to finish
const run = await client.actor("min.h/html-table-data-scraper").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 = {
    "mode": "synthetic",
    "urls": ["https://example.com/"],
    "maxUrls": 1,
    "maxRows": 10,
    "timeoutSecs": 8,
}

# Run the Actor and wait for it to finish
run = client.actor("min.h/html-table-data-scraper").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 '{
  "mode": "synthetic",
  "urls": [
    "https://example.com/"
  ],
  "maxUrls": 1,
  "maxRows": 10,
  "timeoutSecs": 8
}' |
apify call min.h/html-table-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,min.h/html-table-data-scraper"
        }
    }
}
```

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/ks5TaOMvgE79QxjSW/builds/MD4a93tQ8DlOz54Rz/openapi.json
