ロック解除 Excel
PDF4me ロック解除 Excel は REST パスワード保護を解除するエンドポイント Excel 正しいパスワードを入力すると、ワークブックが表示されます。 POST 保護されたファイルとして Base64 に office/ApiV2Excel/ExcelUnlockパスワードを中に入力してください unlockExcelAction、そして、デコードされた保護されていないコピーを JSON 応答。保護を解除するだけで、決して突破することはありません。
保護されたワークブックとそのパスワードを受け取り、保護されていないコピーを返します。ファイル暗号化、ワークブック構造保護、ワークシートロックはすべて一度に解除されるため、自動化されたパイプラインがセルを読み取り、行を追加し、ファイルをマージする前に必要な処理となります。 Excel アクションは保護されていないワークブックを想定しています。応答は JSON 結果として Base64 コンテンツ。
認証 API リクエスト
毎 PDF4me REST 電話にはあなたの API キー Authorization ヘッダーを基本認証として設定します。開発者ダッシュボードからキーを取得またはローテーションしてください。
終点
office/ApiV2Excel/ExcelUnlock見逃してはならない重要な事実
success: 間違い。unlockExcelAction.password 環境変数またはシークレットマネージャーから取得した認証情報の場合、他の認証情報と同様のルールが適用されます。HTTP 設定
方法: POST
URL: https://api.pdf4me.com/office/ApiV2Excel/ExcelUnlock
コンテンツタイプ: アプリケーション/json
Authorization: 基本 <あなたの PDF4me API キー>
回答は JSON: チェック success フラグを立てて、それから Base64返されたワークブックの内容をデコードして保存します。 .xlsx 拡大。
ロック解除すると、どのような保護機能が解除されますか?
Excel 保護は多層構造になっており、各層の動作は異なります。正しいパスワードでロックを解除すると、すべての保護が一度に解除されます。
| 保護と行動 | ブロックするもの | これにより削除されました API |
|---|---|---|
| ファイル暗号化 | パスワードなしでファイルを開くこと | はい、正しいパスワードで |
| ワークブック構造の保護 | シートの追加、削除、または並べ替え | はい |
| ワークシート保護 | ロックされたシートのセルを編集する | はい |
| 不明なパスワード | 上記すべて | いいえ。正しいパスワードが必要です。 |
API ボディフィールド
| パラメータ | 必須 | その機能 | 例 |
|---|---|---|---|
| document | Required | Source file. `Name` must end in `.xlsx`, `.xls` or `.xlsm` (a `.csv` for `ExcelParseCsv`). | { "Name": "data.xlsx" } |
| document.Name | Required | File name including its extension. Type: string. | { "Name": "data.xlsx" } |
| docContent | Required | The source file, base64-encoded. Type: string. | UEsDBBQABgAIAAAA... |
| isAsync | Optional | Process the request in the background. The call returns `202 Accepted`; poll the `Location` URL (`GetActionStatus`) for the result. Type: boolean. | |
| unlockExcelAction | Required | Object carrying this operation's settings. Its fields are the unlockExcelAction rows below. | { "password": "..." } |
| unlockExcelAction.secureOnOpenPassword | Optional | The password that opens the file. Type: string. | |
| unlockExcelAction.workbookProtectionPassword | Optional | The workbook structure password. Type: string. | |
| unlockExcelAction.worksheetProtectionPassword | Optional | The sheet protection password. Type: string. | |
| unlockExcelAction.worksheetNames | Optional | Comma-separated worksheet names. Type: string. | |
| unlockExcelAction.worksheetIndexes | Optional | Comma-separated 1-based worksheet numbers, e.g. `"1,3"`. Type: string. | |
サンプルペイロード
秘密のパスワードを入力してロックを解除します
{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"unlockExcelAction": {
"password": "{{EXCEL_PASSWORD}}"
}
}
明確な文化でロックを解除する
{
"document": { "Name": "quarterly-report.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"unlockExcelAction": {
"password": "{{EXCEL_PASSWORD}}",
"cultureName": "en-US"
}
}
郵便配達員の集荷に関するヒント
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
何が API 戻る?
A JSON 結果として保護されていないワークブックが Base64。
| 分野 | タイプ | 内容物 |
|---|---|---|
document | String (Base64) | The unprotected workbook content. Decode to bytes and save with an .xlsx extension. |
fileName | String | Output filename for the unlocked workbook. |
success | Boolean | true when unlocking succeeded. Check this before decoding content. |
errorMessage | String | Populated when success is false, including the wrong-password case. |
コードサンプル
Excel オフィスエンドポイントはまだパーlanguage サンプルフォルダ。サンプルリポジトリには、すべてのサンプルで使用されるリクエストパターンが含まれています。 PDF4me エンドポイントファミリー:
よくある質問
なぜロックを解除するのか API 手動で行う代わりに?
シートレベルロックの手動ルートは シートの保護を解除して Excelファイルを開き、パスワードを入力し、レビュー タブ、シートの保護を解除し、保存し、ファイルごとに繰り返します。これは、保護されたレポートの夜間フォルダには対応できません。 API ファイルごとに1つの決定論的なリクエストと同じパスワード検証済みの削除を実行し、出力は標準のままです オフィス営業中 XML ワークブックはパイプラインの残りの部分で使用できる状態です。