# PDF to Excel - PDF Form & Scanned Document Data to Rows (`tidytools/pdf-form-to-excel`) Actor

PDF to Excel for filled PDF forms, scanned receipts and printed reports: one aligned row per document or page with your column names, XLSX and CSV downloads. $0.01 per readable page; failed pages are free.

- **URL**: https://apify.com/tidytools/pdf-form-to-excel.md
- **Developed by:** [Yukai Lin](https://apify.com/tidytools) (community)
- **Categories:** AI, Automation, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 extracted pages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 to Excel — form data extraction into aligned rows

Turn filled PDF forms, scanned receipts, and printed reports into a spreadsheet. Each public PDF/JPG/PNG URL becomes one Dataset row by default. Download the same rows as **XLSX** or **CSV**. Choose `oneRowPer: "page"` to get one row for each readable PDF page.

### Input

```json
{"sources":["https://filedone.ai/sample-files/sample-invoice.pdf"],"fields":["invoice_number","total"],"oneRowPer":"document"}
```

- `sources`: up to 500 direct public PDF, JPG, or PNG URLs. A repeated or invalid URL yields a free error row.
- `datasetId` and optional `datasetField`: read source URLs from an Apify Dataset. You can combine these with `sources`.
- `fields`: optional array of 1–50 exact column names. Every row uses these columns, with `null` for a missing value. Leave empty to let AI infer **one shared set** of columns from the first readable document. Output metadata names such as `pageNumber` and `chargedPages` are reserved.
- `templateHeader` (instead of `fields`): paste your spreadsheet's header row, copied from Excel or Google Sheets (tab-separated), a CSV header line (comma or semicolon; quote names that contain commas), or one column name per line. Up to 50 columns; blank header cells are skipped, repeated names are an input error. The output uses these names **exactly, in the same order**, and in XLSX/CSV they come **first**, so the file lines up with your template; the check columns follow.
- `templateUrl` (instead of `templateHeader`): a public CSV or XLSX file, or a Google Sheets link shared as "Anyone with the link". Only the header row is read (for XLSX: the first row with two or more filled cells on the first sheet, so a title row above it is skipped). Old `.xls` files and sign-in pages are input errors, and the run stops before reading any document, free.
- `oneRowPer`: `document` (default) or `page`.
- `maxPdfPages`: first 1–50 pages per PDF (default 20). Only readable pages are sent to extraction.

### Output

The Dataset and files use the same fixed columns: `sourceUrl`, `pages`, `pageNumber`, the requested or inferred fields, `confidence`, `missingFields`, `missingReasons`, `success`, `charged`, `chargedPages`, `errorType`, `error`. With a template, XLSX/CSV start with the template's columns, then `sourceUrl`, `pages`, `pageNumber` and the rest. `pageNumber` identifies the original page in page mode and is blank in document mode. `pages` counts readable pages used for a row. `confidence` is the fraction of requested fields filled, **not** a probability of correctness. `missingFields` lists blank columns. `missingReasons` says why each blank column is blank (Dataset: an object `{column: reason}`; XLSX/CSV: `column: reason; …`):

| Reason | Meaning |
|---|---|
| `not_found` | The value is not in the document. |
| `unclear` | AI saw the field but could not read it reliably (illegible or ambiguous). Check the original. |
| `not_found_in_read_pages` | Not found in the pages that were read; the document has more pages than `maxPdfPages` or than fit in one extraction. |
| `document_not_read` | The file could not be read (invalid URL, download failure, no text). |
| `extraction_failed` | The AI extraction call failed for this row. |

`SUMMARY` contains `xlsxUrl`, `csvUrl`, fields, `fieldsFrom` (`fields`, `templateHeader`, `templateUrl` or `inferred`), row counts, charged page count, and `billingRows` with the final status of each input row. Files are stored as `RESULTS.xlsx` and `RESULTS.csv` in the run's key-value store.

The Dataset must save a row before its charge is attempted, so its `charged` and `chargedPages` values are `null` for an extracted row. Read the final values in XLSX/CSV or `SUMMARY.billingRows`. Rows that failed extraction show `false` and `0` in the Dataset too.

A readable page that produces a saved extracted row uses one existing `page-extracted` event (Free/BRONZE: **$0.01/page**; plan discounts appear in Pricing). Blank pages, unreadable files, invalid URLs, and rows with no requested values are free. Multiple readable pages in one document row cost one event each. There is no start fee or XLSX/CSV event.

### FAQ

**Does the AI always read the form correctly?** No. OCR and AI can misread handwriting, small print, totals, or unusual layouts. **Spot-check the extracted values against the original documents**, especially before accounting or compliance use.

**Can it fill my own Excel template?** Yes: paste the template's header row into `templateHeader` (or link the file in `templateUrl`). Columns keep your exact names and order, and AI matches differently labelled values (for example "Ref #" on the form for a "Reference Number" column). A format written in a header, such as `Date (YYYY-MM-DD)`, is followed where possible.

**Can it align several form layouts?** Yes, when you give `fields` or a template. Automatic columns are inferred once from the first readable document, so mixed layouts may leave more blank fields.

**Can it open private documents?** The URLs must be publicly accessible to the backend. Password-protected or unavailable files return free error rows. Avoid sending documents you lack permission to process.

**What about filled interactive PDF fields?** The answers must appear in the PDF's rendered page or text layer. If a viewer saved answers only as form annotations, flatten or print the filled form to PDF first.

**How are blanks represented?** Missing values are `null` in Dataset and empty cells in XLSX/CSV, with the reason in `missingReasons`. A document with no requested values is a free failure row.

**Does a page always become a row?** In page mode, each *readable* page becomes a row. Completely blank pages have no extraction charge.

### What does it do?

This Actor reads public PDF forms, scanned receipts, and printed reports and writes aligned spreadsheet rows.

### How to use

Paste direct document URLs into sources (or spreadsheet rows in the form `name<Tab>URL` or `name, URL`), optionally supply fields or paste your template's header row, then run. Commas inside a URL path or query string are preserved. Open SUMMARY for the XLSX and CSV links.

### Pricing

A successful row uses the existing page-extracted event once per readable page. Free and BRONZE: $0.01 per page. No start fee. Failed rows are free.

### Limitations

Only public direct PDF/JPG/PNG URLs are accepted. The first 50 pages of each PDF can be read. AI and OCR may be incomplete.

### Use with AI agents (MCP)

Connect Apify's MCP server at https://mcp.apify.com?tools=tidytools/pdf-form-to-excel. Ask for rows from public document URLs; failed items have an errorType and are free.

# Actor input Schema

## `sources` (type: `array`):

Direct public PDF, JPG or PNG URLs, one per line. You can also paste spreadsheet rows as name<Tab>URL or name, URL. Up to 500 files. Use datasetId to read URLs from an Apify Dataset.

## `fields` (type: `array`):

The exact columns to extract from every document, e.g. applicant, date, amount. Leave empty to infer one shared set of column names from the first readable document, or use a template below instead. Maximum 50.

## `templateHeader` (type: `string`):

Paste your spreadsheet's header row (copied from Excel or Google Sheets, or a CSV header line), or one column name per line. The output uses these columns exactly, in this order, first in the XLSX/CSV. Use instead of Column names. Maximum 50 columns.

## `templateUrl` (type: `string`):

Public link to a CSV or XLSX template, or a Google Sheets link shared as "Anyone with the link". Its header row becomes the output columns, as with Template header. Only the header is read.

## `oneRowPer` (type: `string`):

Document combines readable pages. Page creates one row per readable PDF page.

## `datasetId` (type: `string`):

Read source URLs from an Apify Dataset.

## `datasetField` (type: `string`):

Column containing each PDF or image URL. Empty selects a common URL field.

## `maxPdfPages` (type: `integer`):

Only readable pages among the first selected pages are sent to AI and billed.

## Actor input object example

```json
{
  "sources": [
    "https://filedone.ai/sample-files/sample-invoice.pdf"
  ],
  "fields": [
    "invoice_number",
    "total"
  ],
  "oneRowPer": "document",
  "maxPdfPages": 20
}
```

# Actor output Schema

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

No description

## `xlsx` (type: `string`):

No description

## `csv` (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 = {
    "sources": [
        "https://filedone.ai/sample-files/sample-invoice.pdf"
    ],
    "fields": [
        "invoice_number",
        "total"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidytools/pdf-form-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 = {
    "sources": ["https://filedone.ai/sample-files/sample-invoice.pdf"],
    "fields": [
        "invoice_number",
        "total",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("tidytools/pdf-form-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 '{
  "sources": [
    "https://filedone.ai/sample-files/sample-invoice.pdf"
  ],
  "fields": [
    "invoice_number",
    "total"
  ]
}' |
apify call tidytools/pdf-form-to-excel --silent --output-dataset

```

## MCP server setup

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