# PDF Table Extractor: PDF to Excel, JSON, Markdown + QA flags (`timeout/pdf-tables-extractor`) Actor

Extract tables from text-based PDFs into typed JSON rows, Markdown and an Excel workbook. Doubtful values, empty numeric cells and totals that don't add up are flagged instead of guessed. For analysts, data pipelines and AI agents.

- **URL**: https://apify.com/timeout/pdf-tables-extractor.md
- **Developed by:** [Cesar Rodriguez](https://apify.com/timeout) (community)
- **Categories:** AI, Automation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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 Table Extractor: PDF to Excel, JSON & Markdown (with QA flags)

Turn **text-based PDFs** (financial statements, statistical reports, price lists, government tables, invoices with ruled tables) into **structured tables**: typed JSON rows, Markdown, and one **Excel workbook per run**. Every doubtful value is **flagged instead of guessed**.

Built for data teams, analysts and AI/RAG pipelines that need numbers they can check, not a best-effort blob of text.

### What you get (per PDF)

- `tables[]` – headers, **typed numeric rows** (US `1,234.56` and DE `1.234,56` are detected per table), `markdown`, page numbers, per-table `flags`.
- Tables that **continue on the next page** are merged (repeated header or header-less continuation).
- `flags[]` – everything you should look at: empty cells in numeric columns, ambiguous thousands/decimal separators, **totals that do not equal the sum of the rows above**, pages without a text layer, pages that contain images but no readable data.
- `text` – full page-separated text (optional).
- `RESULTS.xlsx` (key-value store, link in the run output) – one sheet per table, yellow cells = review, `Flags` sheet, source file/pages on every row.
- Optional (experimental): values of **vector bar charts that carry numeric data labels**.

### Honest limits

- **No OCR**: scanned PDFs are reported (`status: no-text-layer`, `scannedPages`) and **not charged**. No values are invented.
- Works best on tables with ruling lines or clearly aligned columns. Tables embedded in running prose (typical in academic papers) or with merged/rotated cells can be missed or split – check `flags` and `tableCount`.
- Only public `http(s)` URLs. Files larger than the configured limit are skipped.
- You are responsible for having the right to process the documents you submit.

### Input

```json
{
  "pdfUrls": [{ "url": "https://www.federalreserve.gov/monetarypolicy/files/fomcprojtabl20240918.pdf" }],
  "includeText": true,
  "maxPagesPerPdf": 100,
  "headerMap": { "Revenue": ["sales", "turnover", "umsatz"] }
}
```

`headerMap` is optional and unifies column names across documents; unmapped headers are kept exactly as found.

### Output (dataset item, shortened)

```json
{
  "fileName": "fomcprojtabl20240918.pdf",
  "status": "ok",
  "pages": 17,
  "tableCount": 6,
  "tables": [{
    "index": 1, "pages": [3], "numberLocale": "unknown",
    "headers": ["Variable", "2024", "2025", "2026"],
    "rows": [["Change in real GDP", 2.0, 2.0, 2.0]],
    "markdown": "| Variable | 2024 | ... |",
    "flags": []
  }],
  "flagCount": 0, "flags": [], "scannedPages": []
}
```

### Pricing

Pay per event (see the *Pricing* tab): a small fee per run start, per PDF processed and per table extracted. Failed downloads, non-PDF responses and scanned PDFs without text are **not charged**. Set *Max total charge* on your run to cap spending.

### Use with AI agents / MCP

Runs through the [Apify MCP server](https://mcp.apify.com): an agent can pass PDF URLs and read back structured tables plus the list of items that need human review.

### FAQ

**Does it send my files anywhere?** The Actor downloads the URL you give it, parses it with the open-source `pdfplumber` library inside the run, and stores results in your run storages. No third-party AI service is called.

**Why did it find 0 tables?** The PDF may have no text layer (scan), or the tables may sit inside running text. See `scannedPages` and `flags`; try another document or open an issue in the Actor's *Issues* tab.

**Can it read charts?** Only vector bar charts with numeric data labels, and only when `includeCharts` is on. Everything else is flagged for visual review.

# Actor input Schema

## `pdfUrls` (type: `array`):

Public http(s) links to PDF files with a selectable text layer (scanned PDFs are reported, not OCR'd).

## `includeText` (type: `boolean`):

Add the plain text of every page (page-separated) to each item.

## `includeCharts` (type: `boolean`):

Reads values only from vector bar charts that carry numeric data labels. Anything else is flagged, never guessed.

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

Only the first N pages of each PDF are processed.

## `maxPdfSizeMb` (type: `integer`):

Larger files are skipped with an error item (not charged).

## `maxPdfs` (type: `integer`):

Safety cap on the number of PDFs processed in one run.

## `headerMap` (type: `object`):

Unify column headers across documents: {"Revenue": \["sales","turnover","umsatz"]}. Unmapped headers are kept as found.

## Actor input object example

```json
{
  "pdfUrls": [
    {
      "url": "https://www.federalreserve.gov/monetarypolicy/files/fomcprojtabl20240918.pdf"
    }
  ],
  "includeText": true,
  "includeCharts": false,
  "maxPagesPerPdf": 100,
  "maxPdfSizeMb": 50,
  "maxPdfs": 100
}
```

# Actor output Schema

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

Dataset items (JSON/CSV/Excel via the API format parameter).

## `workbook` (type: `string`):

All tables of the run, one sheet per table, plus a Flags sheet. Present when at least one table or flag was produced.

# 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 = {
    "pdfUrls": [
        {
            "url": "https://www.federalreserve.gov/monetarypolicy/files/fomcprojtabl20240918.pdf"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("timeout/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 = { "pdfUrls": [{ "url": "https://www.federalreserve.gov/monetarypolicy/files/fomcprojtabl20240918.pdf" }] }

# Run the Actor and wait for it to finish
run = client.actor("timeout/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 '{
  "pdfUrls": [
    {
      "url": "https://www.federalreserve.gov/monetarypolicy/files/fomcprojtabl20240918.pdf"
    }
  ]
}' |
apify call timeout/pdf-tables-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,timeout/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/fRyqrmC8KmlYNQwGB/builds/tDXfhzn8ztWctfgZs/openapi.json
