---
name: "pdf123-pdf-to-tables"
description: "Find the tables in a PDF, fix rows and columns in a preview, then download Excel or CSV. Runs the PDF123 \"Extract Tables from PDF\" tool (pdf123.xyz) over its REST API with curl, no account needed. Use when the user wants this done to their file. Also known as: 提取 PDF 表格, Extraer tablas de PDF, PDF से टेबल निकालें, استخراج الجداول من PDF, Extrair tabelas de PDF, Ekstrak Tabel dari PDF, Extraire les tableaux d'un PDF, Извлечь таблицы из PDF, PDFから表を抽出, Tabellen aus PDF extrahieren, PDF에서 표 추출, Trích bảng từ PDF, PDF'den tablo çıkar, 擷取 PDF 表格, Estrai tabelle da PDF, ดึงตารางจาก PDF, Wyodrębnij tabele z PDF, Видобути таблиці з PDF, Tabellen uit PDF halen, Ekstrak Jadual daripada PDF, Extrahera tabeller ur PDF, Εξαγωγή πινάκων από PDF, Извличане на таблици от PDF, Extreu taules d'un PDF, Toa Majedwali kwenye PDF."
compatibility: "Needs curl 7.76+ and outbound HTTPS to pdf123.xyz, or PDFX_API_BASE pointing at a self-hosted pdfx-server."
---

# Extract Tables from PDF (PDF123)

Find the tables in a PDF, fix rows and columns in a preview, then download Excel or CSV.

Web version: https://pdf123.xyz/extract-tables-from-pdf · All tools: https://pdf123.xyz/skills/pdf123.md

## When to use

- Moving a bank or card statement into a spreadsheet
- Extracting an invoice's line items or a report's tables
- Checking what a PDF's tables look like before choosing an export

## Run it

Replace the sample file names and values with the user's, then run:

```bash
API="${PDFX_API_BASE:-https://pdf123.xyz}"
curl -sS --fail-with-body -X POST "$API/api/v1/convert/pdf/tables" \
  -F "fileInput=@input.pdf" \
  -F "pageNumbers=all" \
  -F "ocr=auto" \
  -F "languages=eng" \
  --output-dir "pdf123-output/$(date +%Y%m%d-%H%M%S)" --create-dirs -OJ -w '%{filename_effective} %{content_type}\n'
```

## Inputs

Everything is `multipart/form-data`. The command above already sends each field with its default; keep them all and change only the values the user asked for, since some endpoints reject a missing optional field.

| Field | Type | Required | Default | Notes |
| --- | --- | --- | --- | --- |
| `fileInput` | file | yes | | .pdf (one file) |
| `pageNumbers` | text | no | `all` | Pages to extract. 1-based page list: `1,3-5`, open range `7-`, `all`, or an `n` expression such as `2n` for even pages |
| `ocr` | choice | no | `auto` | Scanned pages. One of: `auto` (Read scanned pages with OCR), `off` (Skip pages without text) |
| `languages` | text | no | `eng` | Document languages |

## Result

curl saves the result in a new `pdf123-output/<timestamp>/` directory under the server's file name and prints its path and content type. Several output files come back as one ZIP. Tell the user where the file is.

## Limits

- Detection needs aligned columns; tables typeset with single spaces between columns may not register
- Merged cells, colored headers and borders are not reconstructed
- OCR on scans is less exact than reading a text layer: verify figures, dates and signs
- At most 50 pages that need OCR per request on this site
- Upload limit on this website: 500 MB per file, sent in chunks above about 95 MB. A single direct API request body is capped at 100 MB.

## Errors

- A non-zero curl exit means the request failed. The saved file then holds `application/problem+json`; read it and report its `detail` to the user instead of retrying blindly.
- `413`: the upload exceeds 100 MiB. `429`: wait for `Retry-After` seconds, then retry once.
- Send `X-API-KEY: $PDFX_API_KEY` only if the user has a PDF123 API key; anonymous calls work without it.

## Privacy

Files are uploaded to the API host, processed, and deleted once the response is sent. For confidential files, ask before uploading, or use a self-hosted server via `PDFX_API_BASE`.
