Passa al contenuto principale

Convertire PDF A Excel

PDF4me Convertire PDF A Excel è un REST endpoint che estrae tabelle e testo da un PDF e restituisce un file modificabile Excel cartella di lavoro. POST UN Base64 PDF A /api/v2/ConvertPdfToExcel, scegli Bozza o Alta qualità, abilita OCR per scansionato pagese salva il risultato .xlsx byte. Una sola chiamata, nessuna riscrittura manuale.

Cosa fa questo endpoint

Invia uno PDF dentro, ne prende uno Excel Cartella di lavoro in uscita. Il motore rileva le strutture delle tabelle su ogni pagina e le ricostruisce come celle di foglio di calcolo, estraendo il testo circostante. qualityType passa tra l'estrazione veloce del livello di testo (Bozza) e riconoscimento pagina per pagina per le scansioni (Alto), E ocrWhenNeeded corse OCR automaticamente quando una pagina non ha un livello di testo. La risposta è il testo grezzo .xlsx binario (200) o un Location sondaggio URL (202).

Articoli correlati del blog
Non ci sono ancora post sul blog dedicati a questa funzionalità — in arrivo a breve.
Nel frattempo, dai un'occhiata al blog di PDF4me per trovare tutorial e procedure operative su tutte le piattaforme.
Visita il blog

Autenticazione del tuo API Richiesta

Ogni PDF4me REST la chiamata deve includere il tuo API chiave nel Authorization Intestazione come autenticazione di base. Ottieni o ruota la tua chiave dalla dashboard dello sviluppatore.

Punto finale

POST/api/v2/Converti PDF in Excel

Informazioni importanti da non perdere

Draft e High sono fatturati in modo diverso
Costo della bozza 1 API chiama per file e legge il livello di testo esistente. Costi elevati 2 API chiama per pagina e rielabora ogni pagina, ed è questo che rende scansionato PDFs lavoro. Non eseguire Alto su pulito digitale PDFs; paghi per pagina per niente.
outputFormat E ocrWhenNeeded sono booleani
I campioni di codice ufficiali vengono inviati VERO / falso JSON valori booleani per entrambi i campi. Le versioni precedenti di questa pagina mostravano valori stringa come "SÌ"; utilizzare valori booleani come negli esempi seguenti.
Async restituisce 202 + Location intestazione
Con asincrono: vero IL API può rispondere 202 con un Location intestazione. GET Quello URL (Stesso Authorization) finché non restituisce 200 con il file binario della cartella di lavoro. Gli esempi ufficiali eseguono il polling ogni 10 secondi, fino a un massimo di 10 tentativi.

HTTP impostare

Metodo: POST
URL: https://api.pdf4me.com/api/v2/ConvertPdfToExcel
Tipo di contenuto: applicazione/json
Authorization: Base <il tuo PDF4me API chiave>

Inviare asincrono: vero nel corpo. 200 restituisce il convertito .xlsx cartella di lavoro come byte binari. 202 restituisce un Location intestazione con un sondaggio URL; GET Quello URL con lo stesso Authorization intestazione fino a quando non restituisce 200 con il file binario della cartella di lavoro.

Quale modalità di qualità devo scegliere: Bozza o Alta?

Draft legge il livello di testo che esiste già all'interno di un creato digitalmente PDF. Esegue il re-rendering e riconosce ogni pagina, il che è più lento e costa di più ma è l'unica modalità che funziona su scansioni, foto di documenti e solo immagini pages.

Draft vs AltoBozzaAlto
Ideale perCreato digitalmente PDFs con testo selezionabileScansionato o basato su immagini PDFs
Costo1 API chiamata per file2 API chiamate per pagina
OCRNon applicatoApplicato per pagina (in coppia con ocrWhenNeeded: true)
VelocitàPassaggio singolo veloceRiconoscimento più lento, pagina per pagina.
Quando i tavoli tornano vuotiRiprova con AltoControllo language se il testo è illeggibile

API campi corporei

ParametroNecessarioTipoCosa faEsempio
docContentRequiredstringBase64-encoded bytes of the source PDF. Strip any data:application/pdf;base64, prefix before posting.JVBERi0xLjcK...
docNameRequiredstringSource filename including the .pdf extension. Used to derive the output filename.invoice-report.pdf
qualityTypeRequiredstringDraft for text-based PDFs (1 API call per file). High for scanned or image-based PDFs (2 API calls per page).Draft
languageConditionalstringLanguage of the text in the source file. Set only when the converted output is not recognizable; otherwise let the engine detect it.English
mergeAllSheetsOptionalbooleantrue combines all extracted content into a single worksheet. false keeps content on separate worksheets.true
outputFormatOptionalbooleanOutput format flag sent as a JSON boolean in the official samples.true
ocrWhenNeededOptionalbooleanRuns OCR automatically on pages without a text layer. Keep true unless you explicitly want recognition skipped.true
asyncOptionalbooleantrue enables the 202 + Location polling pattern, recommended for large or scanned files.true

Esempi di carichi utili

Modalità bozza. digitale PDF con testo selezionabile

{
"docContent": "JVBERi0xLjcKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"docName": "invoice-report.pdf",
"qualityType": "Draft",
"mergeAllSheets": true,
"outputFormat": true,
"ocrWhenNeeded": true,
"async": true
}

Modalità alta. Scansionato PDF con OCR

{
"docContent": "JVBERi0xLjcKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"docName": "scanned-statement.pdf",
"qualityType": "High",
"mergeAllSheets": false,
"language": "English",
"outputFormat": true,
"ocrWhenNeeded": true,
"async": true
}

Consigli per la raccolta del postino

Headers
Content-Type: application/json + Authorization: Basic <apiKey>.
Body
raw JSON. Copy one of the payloads above and replace docContent with your Base64.
Response
Use Send and Download so Postman saves the binary body as a .xlsx file when status is 200. If 202, GET the Location URL with the same Authorization until 200.
Quality
Start with Draft. Only switch to High when tables come back empty, and expect 2 API calls per page in that mode.

esempio di riccio

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

Che cosa significa il API ritorno?

Una conversione riuscita restituisce il Excel il quaderno di lavoro stesso, non un JSON wrapper. L'output è un moderno Ufficio aperto XML cartella di lavoro (.xlsx), il predefinito XMLformato basato su supportato da ogni versione corrente di ExcelGestisci i tre casi seguenti.

CampoTipoCosa contiene
Response body (HTTP 200)BinaryThe 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)BinaryThe finished workbook, returned once processing completes. The official samples poll every 10 seconds, up to 10 retries.
Poll response (HTTP 202)EmptyJob still processing. Wait and poll the same Location URL again.

Esempi di codice

Implementazioni complete e funzionanti, ciascuna con un esempio PDF e il contenuto esatto di questa pagina:

FAQ

Which quality mode should I choose, Draft or High?+
Draft is for digitally created PDFs with a real text layer and costs 1 API call per file. High is for scanned or image-based PDFs and costs 2 API calls per page. Start with Draft; switch to High only when tables come back empty or garbled.
Can the API extract tables from a scanned PDF?+
Yes. Set qualityType to High and ocrWhenNeeded to true. The engine runs OCR on pages without a text layer and reconstructs detected tables as spreadsheet cells in the output workbook.
What does mergeAllSheets do?+
With mergeAllSheets true the extracted content is combined into a single worksheet. With false, content is kept on separate worksheets, so a multi-page PDF maps to multiple sheets in the workbook.
When do I need the language field?+
Only when the converted output is not recognizable. The engine detects the document language automatically; set language explicitly when recognition returns garbled text for your source language.
Is the response JSON or the file itself?+
The file itself. A 200 response body is the raw .xlsx binary. Do not JSON-parse it; write the bytes to disk. Only the 202 case involves reading a header (Location) instead of the body.
My tables came back as plain text without cell structure. What now?+
Rerun with qualityType High so each page goes through recognition, and keep ocrWhenNeeded true. If the text itself is garbled rather than misplaced, set the language field to match the document.
How large can the PDF be?+
Large and scanned files are exactly what the async pattern is for. Send async true and be prepared to poll the Location URL; the official samples poll every 10 seconds, up to 10 retries, before timing out.
Can I get XLS instead of XLSX?+
No. The endpoint returns a modern Open XML workbook (.xlsx). Legacy .xls output is not offered; every current version of Excel, LibreOffice, and Google Sheets opens .xlsx.

Azioni correlate

Stessa attività su altre piattaforme

Richiedi assistenza