# PDF Tables to Excel, CSV & JSON (`mizanlabs/pdf-tables-extractor`) Actor

Extract every table from PDF files into Excel, CSV and JSON. Joins tables that continue over several pages, detects headers, and turns amounts like 1 234,56 € or (1,200.00) into real numbers. Paste PDF links, get one clean table per result plus a ready Excel workbook.

- **URL**: https://apify.com/mizanlabs/pdf-tables-extractor.md
- **Developed by:** [Mizan Labs](https://apify.com/mizanlabs) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 tables

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

## PDF Tables to Excel, CSV & JSON

Extract **every table from your PDF files** into **Excel, CSV and JSON**. Paste PDF links, run, and download **one Excel workbook** with each table on its own sheet. Tables that continue over several pages are **joined into one**, and amounts like `1 234,56 €`, `1.234,56` or `(1,200.00)` become **real numbers** you can sum.

### What does it do?

- **Finds the tables** on every page: tables with cell borders, and tables without borders (column alignment).
- **Joins multi-page tables**: a 16-page list becomes one table, and repeated header rows are removed.
- **Detects headers** and title lines, and names columns even when the PDF leaves them empty.
- **Converts numbers** in US and European formats: `1,234.56`, `1.234,56`, `1 234,56 €`, `(500)`, `12 %`. The decimal separator is detected per column. Codes with leading zeros (zip codes, IDs) stay text.
- **Three outputs at once**:
  - `tables.xlsx`: one workbook, an *Index* sheet plus one sheet per table.
  - One **CSV file per table**, which opens correctly in Excel, accents and € included.
  - **JSON**: one result per table, with rows as objects keyed by column name, ready for Google Sheets, n8n, Make, Zapier or AI agents.
- **A clear report for every file**: a link that fails, a password-protected PDF or a scanned PDF is listed in `SUMMARY` with the reason, and **you don't pay for it**.

### Who is it for?

- Accountants and analysts copying tables out of reports, price lists and statistics
- Developers and automation builders who need PDF tables as JSON in a pipeline
- Anyone who has to turn a long PDF list into a spreadsheet

### How much does it cost?

Pay per result: **$0.003 per table**, plus a tiny start fee. 100 tables cost about **$0.30**. A 600-row table that runs over 15 pages counts as **one** table. Files that fail or contain no tables are free. Use *Maximum tables* to cap your spend.

### How to use it

1. Add your PDF links in **PDF files**. Any public `http`/`https` link that downloads a PDF works.
2. Optional: choose **Pages** (`1-3, 5, 10-`) and **Table detection**.
3. Click **Start**. When the run ends, open the **Output** tab: *All tables (Excel workbook)*, *Tables (overview)*, or JSON.

### Input example

```json
{
  "startUrls": [
    { "url": "https://example.com/annual-report.pdf" },
    { "url": "https://example.com/price-list-2026.pdf" }
  ],
  "pages": "",
  "strategy": "auto",
  "mergeMultiPageTables": true,
  "parseNumbers": true,
  "decimalSeparator": "auto",
  "maxTables": 200
}
```

| Option | Default | What it does |
|---|---|---|
| Pages | all | `1-3, 5, 10-` reads pages 1 to 3, 5, and 10 to the end |
| Table detection | Auto | Auto = borders first, then column alignment. Lines = only tables with borders. Text = only column alignment |
| Join tables that continue on the next page | on | Joins a table that runs over several pages into one table |
| First row is the header | on | A first row made of numbers is always kept as data |
| Convert numbers | on | Off = every cell stays text, exactly as in the PDF |
| Decimal separator | Auto | Force dot or comma if your numbers are ambiguous (e.g. `1,234`) |
| Maximum tables / pages / file size | 1000 / 300 / 50 MB | Limits per run / per PDF |

### Output example

One result per table (shortened):

```json
{
  "fileName": "budget.pdf",
  "tableNumber": 1,
  "pages": "1-2",
  "mergedAcrossPages": true,
  "columns": ["Poste", "Catégorie", "Montant", "Taux"],
  "rowCount": 60,
  "numericColumns": ["Montant", "Taux"],
  "rows": [
    { "Poste": "Poste 01", "Catégorie": "Fournitures", "Montant": 1234.5, "Taux": 1.5 },
    { "Poste": "Poste 02", "Catégorie": "Fournitures", "Montant": 2469.0, "Taux": 2.5 }
  ],
  "csv": "Poste,Catégorie,Montant,Taux\nPoste 01,Fournitures,1234.5,1.5\n...",
  "csvUrl": "https://api.apify.com/v2/key-value-stores/.../records/001-budget-table-1.csv"
}
```

In this example the PDF showed `1 234,50 €` and `1,5 %`. The output has the numbers `1234.5` and `1.5`.

### Tips and limits

- **Works best with digital PDFs**: PDFs exported from Excel, Word, accounting software, reporting tools or websites.
- **Scanned PDFs are not supported** (no OCR). They are reported as *"looks like a scanned PDF"* and not charged.
- **Password-protected PDFs** are reported and not charged.
- **No table found?** Try *Table detection* = **Text**. For tables with cell borders, **Lines** gives the cleanest result.
- **Very unusual layouts** may need cleanup: headers spread over several lines, or text in rotated columns. Check the first results before a big run.
- Percentages keep the number shown: `12 %` becomes `12`, not `0.12`.

### Integrations and API

Run it from the Apify API, a schedule, or tools like **Make, n8n and Zapier**. Download results as JSON, CSV, Excel or XML from the dataset, or fetch `tables.xlsx` from the run's key-value store.

### Your data

Files are downloaded only to extract their tables during your run. Results stay in your own Apify storage. Only use PDFs you have the right to process.

### Need a custom version?

Rather not run it yourself? Send us up to 20 digital PDFs and get the tables back as clean Excel for $19 a batch, or ask for a custom scraper for public data: [mizanlabs.devsupex.app/services](https://mizanlabs.devsupex.app/services).

### Support

Found a PDF that comes out wrong? Open an issue with the link (if it's public) and we will look at it.

# Actor input Schema

## `startUrls` (type: `array`):

Links to the PDF files (http or https). Any link that downloads a PDF works: reports, price lists, government statistics, files you host yourself.

## `pages` (type: `string`):

Pages to read in every PDF, e.g. 1-3, 5, 10- (10 to the end). Leave empty for all pages.

## `strategy` (type: `string`):

Auto: tables with cell borders first, then column alignment for tables without borders. Lines: only tables with borders. Text: only column alignment (try it when Auto finds nothing).

## `mergeMultiPageTables` (type: `boolean`):

A table that runs over several pages becomes one table. Repeated header rows are removed.

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

Use the first row as column names (a first row of numbers is always treated as data). Off: columns are named Column 1, Column 2...

## `parseNumbers` (type: `boolean`):

Turn number columns into real numbers: '1 234,56 €' becomes 1234.56, '(1,200.00)' becomes -1200, '12 %' becomes 12. Codes with leading zeros (zip codes, IDs) stay text.

## `decimalSeparator` (type: `string`):

Auto detects it per column (1,5 vs 1.5). Set it when your numbers are ambiguous, like 1,234.

## `maxTables` (type: `integer`):

Stop after this many tables. You pay per table, so this caps your spend.

## `maxPagesPerPdf` (type: `integer`):

Read at most this many pages of each PDF.

## `maxFileSizeMb` (type: `integer`):

Skip PDFs bigger than this.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://raw.githubusercontent.com/jsvine/pdfplumber/stable/tests/pdfs/WARN-Report-for-7-1-2015-to-03-25-2016.pdf"
    }
  ],
  "pages": "",
  "strategy": "auto",
  "mergeMultiPageTables": true,
  "firstRowIsHeader": true,
  "parseNumbers": true,
  "decimalSeparator": "auto",
  "maxTables": 1000,
  "maxPagesPerPdf": 300,
  "maxFileSizeMb": 50
}
```

# Actor output Schema

## `excel` (type: `string`):

No description

## `results` (type: `string`):

No description

## `resultsJson` (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 = {
    "startUrls": [
        {
            "url": "https://raw.githubusercontent.com/jsvine/pdfplumber/stable/tests/pdfs/WARN-Report-for-7-1-2015-to-03-25-2016.pdf"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("mizanlabs/pdf-tables-extractor").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 = { "startUrls": [{ "url": "https://raw.githubusercontent.com/jsvine/pdfplumber/stable/tests/pdfs/WARN-Report-for-7-1-2015-to-03-25-2016.pdf" }] }

# Run the Actor and wait for it to finish
run = client.actor("mizanlabs/pdf-tables-extractor").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 '{
  "startUrls": [
    {
      "url": "https://raw.githubusercontent.com/jsvine/pdfplumber/stable/tests/pdfs/WARN-Report-for-7-1-2015-to-03-25-2016.pdf"
    }
  ]
}' |
apify call mizanlabs/pdf-tables-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mizanlabs/pdf-tables-extractor"
        }
    }
}
```

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/sw4eYYl5ZkRgkjhO1/builds/hOa0sn6Nkj4IND1M1/openapi.json
