Secure Document - Excel API
PDF4me Secure Excel enables you to apply password protection to Excel documents at multiple levels. This API service supports file encryption (password to open), workbook structure protection (prevent sheet modifications), and worksheet content protection (prevent cell edits), with flexible password hierarchy and protection types (Contents, Objects, Scenarios, All). The API receives Excel document content through REST API calls, utilizing Base64 encoding for secure transmission. This solution is ideal for confidential data protection, template security, and controlled access workflows.
Authenticating Your API Request
Include your API key in the request to authenticate with the PDF4me REST API.
Key Features
- Three Protection Levels: File encryption, workbook structure, worksheet content
- Independent Passwords: Use different passwords for each protection level
- Password Fallback: Use main password as fallback when level-specific password not provided
- Flexible Worksheet Selection: Protect specific worksheets or all worksheets
- Protection Type Options: Contents, Objects, Scenarios, or All (comprehensive)
- 0-Based Indexing: Worksheet indexes use 0-based numbering (0 = first worksheet)
REST API Endpoint
- Method: POST
- Endpoint:
office/ApiV2Excel/ExcelSecure
REST API Parameters
Important: Parameters marked with an asterisk (*) are required. All requests use document, docContent, and secureExcelAction. Operation-specific parameters (password, protectWorkbook, etc.) are properties of the action object.
Required Parameters (root level)
| Parameter | Type | Description | Example |
|---|---|---|---|
| document* | Object | Document reference with Name (Excel file name) | { "Name": "data.xlsx" } |
| docContent* | String (Base64) | Excel document content encoded in Base64 | UEsDBBQABgAIAAAA... |
| secureExcelAction* | Object | Action configuration (password, protection levels, worksheet selection) | See Payload example below |
Optional Parameters (inside secureExcelAction)
| Parameter | Type | Description | Example |
|---|---|---|---|
| password | String | File encryption password (Level 1). Also used as fallback for workbook/worksheet protection if their passwords are empty | MyPassword123 |
| protectWorkbook | Boolean | Enable workbook structure protection (Level 2). Default: false | true |
| protectWorkbookPassword | String | Workbook protection password. Fallback: password if empty | StructurePass |
| protectWorksheets | Boolean | Enable worksheet content protection (Level 3). Default: false | true |
| worksheetProtectionType | String | Contents, Objects, Scenarios, or All. Default: All | All |
| worksheetProtectionPassword | String | Worksheet protection password. Fallback: password if empty | EditPass |
| worksheetNames | String | Comma-separated worksheet names to protect; empty = all | Sheet1,Summary |
| worksheetIndexes | String | Comma-separated worksheet indexes (0-based); empty = all | 0,2 |
| cultureName | String | Culture code for processing | en-US |
Output
The API returns the password-protected Excel document as a Base64-encoded string in JSON format (document, fileName, success, errorMessage).
Request Example
Header
Content-Type: application/json
Authorization: Basic YOUR_BASE64_ENCODED_API_KEY
Payload (Basic)
{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"secureExcelAction": {
"password": "MyPassword123",
"protectWorkbook": true,
"protectWorksheets": true
}
}