Lewati ke konten utama

Mengubah PDF ke Excel

PDF4me Mengubah PDF ke Excel adalah sebuah REST titik akhir yang mengekstrak tabel dan teks dari sebuah PDF dan mengembalikan yang dapat diedit. Excel buku kerja. POST A Base64 PDF ke /api/v2/ConvertPdfToExcel, pilih Draft atau Kualitas Tinggi, aktifkan OCR untuk dipindai pages, dan simpan yang dikembalikan .xlsx byte. Satu panggilan, tanpa pengetikan ulang manual.

Fungsi dari endpoint ini

Mengirim satu PDF masuk, mendapat satu Excel Setelah lembar kerja dikeluarkan, mesin mendeteksi struktur tabel di setiap halaman dan membangunnya kembali sebagai sel spreadsheet, mengekstrak teks di sekitarnya. qualityType peralihan antara ekstraksi lapisan teks cepat (Draf) dan pengenalan per halaman untuk pemindaian (Tinggi), Dan ocrWhenNeeded lari OCR Secara otomatis ketika sebuah halaman tidak memiliki lapisan teks. Responsnya adalah data mentah. .xlsx biner (200) atau sebuah Location jajak pendapat URL (202).

Postingan Blog Terkait
Belum ada postingan blog untuk fitur ini — akan segera hadir.
Sementara itu, jelajahi blog PDF4me untuk menemukan tutorial dan alur kerja di berbagai platform.
Kunjungi blog ini

Memverifikasi Identitas Anda API Meminta

Setiap PDF4me REST panggilan harus menyertakan Anda API kunci di Authorization Header sebagai otentikasi Dasar. Dapatkan atau putar kunci Anda dari dasbor pengembang.

Titik akhir

POST/api/v2/KonversiPdfKeExcel

Fakta Penting yang Tidak Boleh Anda Lewatkan

Draft dan High ditagih secara berbeda.
Draf biaya 1 API Memanggil per berkas dan membaca lapisan teks yang ada. Biaya tinggi 2 API melakukan panggilan per halaman dan memproses ulang setiap halaman, itulah yang membuat proses pemindaian berhasil. PDFs Jangan jalankan pada kecepatan tinggi di perangkat digital yang bersih. PDFsAnda membayar per halaman untuk sesuatu yang tidak Anda dapatkan.
outputFormat Dan ocrWhenNeeded adalah boolean
Contoh kode resmi dikirim BENAR / PALSU JSON Nilai boolean untuk kedua kolom. Versi lama halaman ini menampilkan nilai string seperti "Ya"Gunakan tipe data boolean seperti pada contoh di bawah ini.
Async mengembalikan 202 + Location judul
Dengan asinkron: benar itu API dapat menjawab 202 dengan Location Judul. GET itu URL (sama Authorization) hingga mengembalikan kode 200 dengan biner buku kerja. Contoh resmi melakukan polling setiap 10 detik, hingga 10 kali percobaan ulang.

HTTP pengaturan

Metode: POST
URL: https://api.pdf4me.com/api/v2/ConvertPdfToExcel
Tipe Konten: aplikasi/json
Authorization: Dasar <Anda PDF4me API kunci>

Mengirim asinkron: benar di dalam tubuh. 200 mengembalikan yang telah dikonversi .xlsx buku kerja sebagai byte biner. 202 mengembalikan Location header dengan jajak pendapat URL; GET itu URL dengan yang sama Authorization header hingga mengembalikan kode 200 dengan binary workbook.

Mode kualitas mana yang sebaiknya saya pilih: Draft atau High?

Draft membaca lapisan teks yang sudah ada di dalam objek yang dibuat secara digital. PDF. Rendering ulang tingkat tinggi dan pengenalan setiap halaman, yang lebih lambat dan lebih mahal tetapi merupakan satu-satunya mode yang berfungsi pada hasil pindaian, foto dokumen, dan gambar saja. pages.

Draft vs. TinggiDrafTinggi
Terbaik untukDibuat secara digital PDFs dengan teks yang dapat dipilihDipindai atau berbasis gambar PDFs
Biaya1 API panggilan per berkas2 API panggilan per halaman
OCRTidak diterapkanDiterapkan per halaman (pasangkan dengan ocrWhenNeeded: true)
KecepatanCepat, sekali lewatPengenalan per halaman yang lebih lambat
Saat meja-meja kembali kosongCoba lagi dengan pengaturan TinggiMemeriksa language jika teksnya acak-acakan

API bidang tubuh

ParameterDiperlukanJenisApa fungsinya?Contoh
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

Contoh muatan

Mode draf. digital PDF dengan teks yang dapat dipilih

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

Mode tinggi. dipindai PDF dengan OCR

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

Tips pengambilan oleh tukang pos

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.

contoh curl

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

Apa arti dari API kembali?

Konversi yang berhasil akan mengembalikan Excel buku kerja itu sendiri, bukan sebuah JSON pembungkus. Outputnya adalah modern Kantor Buka XML buku kerja (.xlsx), default XMLformat berbasis didukung oleh setiap versi terkini dari ExcelTangani ketiga kasus di bawah ini.

BidangJenisIsi di dalamnya
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.

Contoh kode

Implementasi ujung-ke-ujung yang sedang dikerjakan, masing-masing dengan contoh. PDF dan muatan persis dari halaman ini:

Pertanyaan yang Sering Diajukan (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.

Tindakan terkait

Tugas yang sama di platform lain

Dapatkan Bantuan