Lewati ke konten utama

Buka kunci Excel

PDF4me Buka kunci Excel adalah sebuah REST titik akhir yang menghapus perlindungan kata sandi dari sebuah Excel buku kerja saat Anda memasukkan kata sandi yang benar. POST berkas yang dilindungi sebagai Base64 ke office/ApiV2Excel/ExcelUnlock, masukkan kata sandi di dalam unlockExcelAction, dan simpan salinan yang telah didekode dan tidak terlindungi dari JSON respons. Ini menghilangkan perlindungan; ini tidak pernah berhasil menembusnya.

Fungsi dari endpoint ini

Mengambil buku kerja yang dilindungi beserta kata sandinya dan mengembalikan salinan yang tidak dilindungi. Enkripsi file, perlindungan struktur buku kerja, dan penguncian lembar kerja semuanya dihapus dalam satu kali proses, yang dibutuhkan oleh alur kerja otomatis sebelum dapat membaca sel, menambahkan baris, atau menggabungkan file: setiap dua langkah. Excel Tindakan tersebut mengharapkan buku kerja yang tidak terlindungi. Responsnya adalah JSON dengan hasil sebagai berikut: Base64 isi.

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

POSTkantor/ApiV2Excel/ExcelUnlock

Fakta Penting yang Tidak Boleh Anda Lewatkan

Membutuhkan kata sandi yang benar. Bukan peretas.
Yang API Menghapus perlindungan saat Anda memasukkan kata sandi yang digunakan untuk menerapkannya. Fitur ini tidak dapat melewati, memulihkan, atau melakukan serangan brute-force pada kata sandi yang tidak diketahui; kata sandi yang salah akan mengembalikan nilai false. success: PALSU.
Jangan pernah memasukkan kata sandi secara langsung ke dalam payload.
Isi permintaan akhirnya masuk ke dalam skrip, log, dan kontrol versi. Suntikkan unlockExcelAction.password dari variabel lingkungan atau pengelola rahasia, aturannya sama seperti kredensial lainnya.
Buka kunci terlebih dahulu, lalu otomatiskan.
Lainnya Excel Tindakan (menambahkan baris, mengekstrak lembar kerja, menggabungkan file) mengharapkan buku kerja yang tidak terlindungi. Gunakan ExcelUnlock sebagai langkah pertama dan berikan outputnya ke langkah selanjutnya.

HTTP pengaturan

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

Jawabannya adalah... JSON: periksa success bendera, lalu Base64-mendekode konten buku kerja yang dikembalikan dan menyimpannya dengan sebuah .xlsx Ekstensi.

Perlindungan apa saja yang dihilangkan dengan membuka kunci?

Excel Perlindungan berlapis, dan setiap lapisan memiliki perilaku yang berbeda. Membuka kunci dengan kata sandi yang benar akan menghapus semua lapisan tersebut sekaligus.

Perlindungan vs perilakuApa yang diblokirnyaDihapus oleh ini API
Enkripsi berkasMembuka file sama sekali tanpa kata sandiYa, dengan kata sandi yang benar.
Perlindungan struktur buku kerjaMenambahkan, menghapus, atau menyusun ulang lembar kerja.Ya
Perlindungan lembar kerjaMengedit sel pada lembar kerja yang terkunciYa
Kata sandi yang tidak diketahui dan hilang.Semua yang disebutkan di atasTidak. Kata sandi yang benar diperlukan.

API bidang tubuh

ParameterDiperlukanJenisApa fungsinya?Contoh
documentRequiredobjectDocument reference carrying Name, the protected Excel filename with its extension.{ "Name": "data.xlsx" }
docContentRequiredstringBase64-encoded bytes of the password-protected workbook.UEsDBBQABgAIAAAA...
unlockExcelActionRequiredobjectAction configuration object holding the password and optional culture settings.{ "password": "..." }
passwordRequiredstringInside the action object. The password that was used to protect the file. Inject from a secret store; never hardcode.{{EXCEL_PASSWORD}}
cultureNameOptionalstringInside the action object. Culture code applied during processing.en-US

Contoh muatan

Buka dengan kata sandi yang disisipkan rahasia.

{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"unlockExcelAction": {
"password": "{{EXCEL_PASSWORD}}"
}
}

Buka dengan budaya eksplisit

{
"document": { "Name": "quarterly-report.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"unlockExcelAction": {
"password": "{{EXCEL_PASSWORD}}",
"cultureName": "en-US"
}
}

Tips pengambilan oleh tukang pos

Headers
Content-Type: application/json + Authorization: Basic <apiKey>.
Body
raw JSON. The password goes INSIDE unlockExcelAction, not at the root. Use a Postman environment variable for it.
Response
JSON with a success flag and Base64 workbook content. Decode the content before saving as .xlsx.
Failures
A wrong password returns success false with an errorMessage; nothing is partially unlocked and the source is untouched.

contoh curl

curl -X POST https://api.pdf4me.com/office/ApiV2Excel/ExcelUnlock \
-H "Content-Type: application/json" \
-H "Authorization: Basic YOUR_API_KEY" \
-d '{
"document": { "Name": "data.xlsx" },
"docContent": "'"$(base64 -w 0 data.xlsx)"'",
"unlockExcelAction": {
"password": "'"$EXCEL_PASSWORD"'"
}
}' \
--output response.json

Apa arti dari API kembali?

A JSON hasil yang membawa buku kerja yang tidak terlindungi sebagai Base64.

BidangJenisIsi di dalamnya
documentString (Base64)The unprotected workbook content. Decode to bytes and save with an .xlsx extension.
fileNameStringOutput filename for the unlocked workbook.
successBooleantrue when unlocking succeeded. Check this before decoding content.
errorMessageStringPopulated when success is false, including the wrong-password case.

Contoh kode

Excel Perangkat ujung kantor belum tercakup oleh per-language folder sampel; repositori sampel membawa pola permintaan yang digunakan oleh setiap PDF4me keluarga titik akhir:

Pertanyaan yang Sering Diajukan (FAQ)

Can this API unlock an Excel file without the password?+
No. The unlock action removes protection using the correct password you supply in unlockExcelAction.password. It is a workflow tool for files whose password you legitimately hold, not a password cracker or recovery service.
Which kinds of Excel protection does it remove?+
File encryption (the password prompt when opening), workbook structure protection, and worksheet protection are removed in one pass, returning a fully unprotected copy of the workbook.
Is the response the file itself?+
No. The API returns JSON containing the unlocked workbook as a Base64 string plus fileName, success, and errorMessage fields. Decode the content to bytes before saving as .xlsx.
What happens if I send the wrong password?+
The operation fails: success comes back false and errorMessage explains the failure. The workbook is never partially unlocked and your source file is never modified.
Does unlocking change the workbook contents?+
No. Cells, formulas, formatting, and sheets are untouched. Only the protection layers are removed; the output is the same workbook without the locks.
How do I keep the password out of my scripts?+
Inject it at runtime: a Postman environment variable, an environment variable in shell scripts, or a secrets manager in production code. Request bodies frequently end up in logs and version control, so treat the payload as sensitive.
Can I re-protect the file after processing?+
Yes. Chain the Secure Excel action after your processing steps to apply fresh protection to the finished workbook.

Mengapa membuka kunci melalui API alih-alih secara manual?

Rute manual untuk kunci sejajar lembaran adalah membuka perlindungan lembaran di ExcelBuka file, masukkan kata sandi, tab Tinjau, Buka Proteksi Lembar, simpan, ulangi untuk setiap file. Cara ini tidak efektif untuk folder laporan yang dilindungi setiap malam. API melakukan penghapusan terverifikasi kata sandi yang sama seperti satu permintaan deterministik per file, dan outputnya tetap standar. Kantor Buka XML Buku kerja siap untuk langkah selanjutnya dalam alur kerja.

Tindakan terkait

Tugas yang sama di platform lain

Dapatkan Bantuan