Convert PDF to Excel
PDF4me Convert PDF to Excel is a REST endpoint that extracts tables and text from a PDF and returns an editable Excel workbook. POST a Base64 PDF to /api/v2/ConvertPdfToExcel, pick Draft or High quality, enable OCR for scanned pages, and save the returned .xlsx bytes. One call, no manual retyping.
Sends one PDF in, gets one Excel workbook out. The engine detects table structures on each page and rebuilds them as spreadsheet cells, extracting the surrounding text alongside. qualityType switches between fast text-layer extraction (Draft) and per-page recognition for scans (High), and ocrWhenNeeded runs OCR automatically when a page has no text layer. The response is the raw .xlsx binary (200) or a Location poll URL (202).
Authenticating Your API Request
Every PDF4me REST call must include your API key in the Authorization header as Basic auth. Get or rotate your key from the developer dashboard.
Endpoint
/api/v2/ConvertPdfToExcelImportant Facts You Should Not Miss
outputFormat and ocrWhenNeeded are booleanstrue / false JSON booleans for both fields. Older copies of this page showed string values like "yes"; use booleans as in the samples below.async: true the API may respond 202 with a Location header. GET that URL (same Authorization) until it returns 200 with the workbook binary. The official samples poll every 10 seconds, up to 10 retries.HTTP setup
Method: POST
URL: https://api.pdf4me.com/api/v2/ConvertPdfToExcel
Content-Type: application/json
Authorization: Basic <your PDF4me API key>
Send async: true in the body. 200 returns the converted .xlsx workbook as binary bytes. 202 returns a Location header with a poll URL; GET that URL with the same Authorization header until it returns 200 with the workbook binary.
Which quality mode should I choose: Draft vs High?
Draft reads the text layer that already exists inside a digitally created PDF. High re-renders and recognizes every page, which is slower and costs more but is the only mode that works on scans, photos of documents, and image-only pages.
| Draft vs High | Draft | High |
|---|---|---|
| Best for | Digitally created PDFs with selectable text | Scanned or image-based PDFs |
| Cost | 1 API call per file | 2 API calls per page |
| OCR | Not applied | Applied per page (pair with ocrWhenNeeded: true) |
| Speed | Fast, single pass | Slower, per-page recognition |
| When tables come back empty | Retry with High | Check language if text is garbled |
API body fields
| Parameter | Required | Type | What it does | Example |
|---|---|---|---|---|
docContent | Required | string | Base64-encoded bytes of the source PDF. Strip any data:application/pdf;base64, prefix before posting. | JVBERi0xLjcK... |
docName | Required | string | Source filename including the .pdf extension. Used to derive the output filename. | invoice-report.pdf |
qualityType | Required | string | Draft for text-based PDFs (1 API call per file). High for scanned or image-based PDFs (2 API calls per page). | Draft |
language | Conditional | string | Language of the text in the source file. Set only when the converted output is not recognizable; otherwise let the engine detect it. | English |
mergeAllSheets | Optional | boolean | true combines all extracted content into a single worksheet. false keeps content on separate worksheets. | true |
outputFormat | Optional | boolean | Output format flag sent as a JSON boolean in the official samples. | true |
ocrWhenNeeded | Optional | boolean | Runs OCR automatically on pages without a text layer. Keep true unless you explicitly want recognition skipped. | true |
async | Optional | boolean | true enables the 202 + Location polling pattern, recommended for large or scanned files. | true |
Sample payloads
Draft mode. digital PDF with selectable text
{
"docContent": "JVBERi0xLjcKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"docName": "invoice-report.pdf",
"qualityType": "Draft",
"mergeAllSheets": true,
"outputFormat": true,
"ocrWhenNeeded": true,
"async": true
}
High mode. scanned PDF with OCR
{
"docContent": "JVBERi0xLjcKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"docName": "scanned-statement.pdf",
"qualityType": "High",
"mergeAllSheets": false,
"language": "English",
"outputFormat": true,
"ocrWhenNeeded": true,
"async": true
}
Postman collection tips
curl example
curl -X POST https://api.pdf4me.com/api/v2/ConvertPdfToExcel \
-H "Content-Type: application/json" \
-H "Authorization: Basic YOUR_API_KEY" \
-d '{
"docContent": "'"$(base64 -w 0 invoice-report.pdf)"'",
"docName": "invoice-report.pdf",
"qualityType": "Draft",
"mergeAllSheets": true,
"outputFormat": true,
"ocrWhenNeeded": true,
"async": true
}' \
--output converted.xlsx
What does the API return?
A successful conversion returns the Excel workbook itself, not a JSON wrapper. The output is a modern Office Open XML workbook (.xlsx), the default XML-based format supported by every current version of Excel. Handle the three cases below.
| Field | Type | What it contains |
|---|---|---|
| Response body (HTTP 200) | Binary | The converted .xlsx workbook bytes. Write them straight to a file with an .xlsx extension. |
| Location header (HTTP 202) | String (URL) | Poll URL for an async job that is still running. GET it with the same Authorization header. |
| Poll response (HTTP 200) | Binary | The finished workbook, returned once processing completes. The official samples poll every 10 seconds, up to 10 retries. |
| Poll response (HTTP 202) | Empty | Job still processing. Wait and poll the same Location URL again. |
Code samples
Working end-to-end implementations, each with a sample PDF and the exact payload from this page: