Protect an Excel Workbook Using Aspose.Cells Cloud API
REST API
This REST API protects an Excel workbook, enabling you to securely protect an Excel workbook with password and protection options using Aspose.Cells Cloud.
POST https://api.aspose.cloud/v3.0/cells/{name}/protection
Security and Authentication
The Aspose.Cells Cloud APIs are secure and require JWT token-based authentication.
Query Parameters
| Parameter Name | Type | Description |
|---|---|---|
| folder | string | Folder that contains the source workbook. (optional) |
| storageName | string | Name of the storage location. (optional; default = “Default”) |
Request Body Parameters
| Parameter Name | Type | Description |
|---|---|---|
| protection | WorkbookProtectionRequest | Object that defines the protection settings for the workbook. |
WorkbookProtectionRequest
| Parameter Name | Type | Description |
|---|---|---|
| ProtectionType | string | Type of protection to apply. Allowed values (case‑insensitive): ALL, CONTENTS, NONE, OBJECTS, SCENARIOS, STRUCTURE, WINDOWS. |
| Password | string | Optional password to set for the protection. |
Response
{
"Status":"OK",
"Code":200
}
Http Status Codes
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Compression succeeded; response contains compressed file details. |
| 400 | Bad Request | Missing or invalid parameters (e.g., unsupported file type). |
| 401 | Unauthorized | Invalid or missing JWT token. |
| 413 | Payload Too Large | Uploaded file exceeds size limit. |
| 500 | Internal Server Error | Unexpected server error. |
How to Use the PostProtectDocument API with SDKs
PostProtectDocument API Specification
The OpenAPI Specification defines a publicly accessible programming interface and lets you carry out REST interactions directly from a web browser.
Example: Protect a Workbook with cURL
-
Obtain an access token as described in Prerequisites / Authentication.
-
Execute the request:
curl -X POST "https://api.aspose.cloud/v3.0/cells/test.xlsx/protection?folder=MyFolder&storageName=MyStorage" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <access_token>" \ -d '{ "ProtectionType": "ALL", "Password": "aspose" }'
Use Aspose.Cells Cloud SDKs
Using an SDK is the fastest way to develop against Aspose.Cells Cloud. An SDK abstracts low‑level details, allowing you to focus on your business logic. See the GitHub repository for a complete list of Aspose.Cells Cloud SDKs.
The following code examples demonstrate how to call Aspose.Cells web services using various SDKs: