Delete all OLE objects in an Excel worksheet

OleObjects – Clear removes all OLE (Object Linking and Embedding) objects from a specified worksheet while leaving cell data untouched. This operation is useful for cleaning legacy spreadsheets or preparing a workbook for redistribution.


Prerequisites

Note: The operation is idempotent – calling it when no OLE objects exist returns a successful 200 OK.


HTTP Request

DELETE https://api.aspose.cloud/v3.0/cells/{name}/worksheets/{sheetName}/oleobjects

Path parameters

Name Type Required Description
name string ✔️ The name of the workbook file.
sheetName string ✔️ The name of the worksheet.

Query parameters

Name Type Required Description
folder string optional Folder containing the workbook.
storageName string optional Storage name where the workbook is located.

Headers

Header Value
Authorization Bearer <jwt token>
Accept application/json
Content-Type application/json

Request Example (cURL)

curl -v "https://api.aspose.cloud/v3.0/cells/Embedded_OleObject_Sample_Book1.xlsx/worksheets/Sheet1/oleobjects?folder=Samples&storageName=MyStorage" \
     -X DELETE \
     -H "Authorization: Bearer <jwt token>" \
     -H "Accept: application/json" \
     -H "Content-Type: application/json"

Replace <jwt token> with a valid access token and adjust folder/storageName as needed.


Successful Response

{
  "Code": 200,
  "Status": "OK"
}

HTTP Status Codes

Code Meaning Description
200 OK Filter applied successfully; response contains operation 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.

SDK Samples

The following code snippets demonstrate how to invoke DeleteWorksheetOleObjects with the official Aspose.Cells Cloud SDKs. Replace placeholder values (<YOUR_TOKEN>, <FILE_NAME>, etc.) with your own data.

Language Sample
C#
Show C# examplecsharp\nusing Aspose.Cells.Cloud.SDK.Api;\nusing Aspose.Cells.Cloud.SDK.Model;\n\nvar config = new Configuration { AccessToken = \"<YOUR_TOKEN>\", BasePath = \"https://api.aspose.cloud\" };\nvar api = new OleObjectsApi(config);\napi.DeleteWorksheetOleObjects(name: \"Sample.xlsx\", sheetName: \"Sheet1\", folder: \"Samples\", storageName: null);\n
Java
Show Java examplejava\nimport com.aspose.cells.cloud.api.OleObjectsApi;\nimport com.aspose.cells.cloud.client.ApiClient;\nimport com.aspose.cells.cloud.client.Configuration;\n\nConfiguration config = new Configuration();\nconfig.setAccessToken(\"<YOUR_TOKEN>\");\nconfig.setBasePath(\"https://api.aspose.cloud\");\nOleObjectsApi api = new OleObjectsApi(new ApiClient(config));\napi.deleteWorksheetOleObjects(\"Sample.xlsx\", \"Sheet1\", \"Samples\", null);\n
Python
Show Python examplepython\nfrom asposecellscloud import ApiClient, Configuration, OleObjectsApi\n\nconfig = Configuration()\nconfig.access_token = '<YOUR_TOKEN>'\nconfig.host = 'https://api.aspose.cloud'\nclient = ApiClient(configuration=config)\napi = OleObjectsApi(client)\napi.delete_worksheet_ole_objects(name='Sample.xlsx', sheet_name='Sheet1', folder='Samples')\n
Node.js
Show Node.js examplejavascript\nconst { OleObjectsApi, Configuration } = require('asposecellscloud');\n\nlet config = new Configuration({ accessToken: '<YOUR_TOKEN>', basePath: 'https://api.aspose.cloud' });\nlet api = new OleObjectsApi(config);\napi.deleteWorksheetOleObjects('Sample.xlsx', 'Sheet1', { folder: 'Samples' })\n .then(() => console.log('All OLE objects deleted'))\n .catch(err => console.error(err));\n
Go
Show Go examplego\npackage main\nimport (\n \"context\"\n \"github.com/aspose-cells-cloud/aspose-cells-cloud-go/v3\"\n)\n\nfunc main() {\n cfg := asposecellscloud.NewConfiguration()\n cfg.AccessToken = \"<YOUR_TOKEN>\"\n cfg.Host = \"https://api.aspose.cloud\"\n api := asposecellscloud.NewOleObjectsApi(cfg)\n _, err := api.DeleteWorksheetOleObjects(context.Background(), \"Sample.xlsx\", \"Sheet1\", map[string]interface{}{ \"folder\": \"Samples\" })\n if err != nil { panic(err) }\n println(\"All OLE objects deleted\")\n}\n

Full source files for all supported languages are available in the Aspose.Cells Cloud GitHub repository.


Errors & Handling

Implement retry logic with exponential back‑off for transient 500 errors.


FAQ

Q1: Do I need to specify the folder and storageName parameters?
A: No. If omitted, Aspose Cloud assumes the default storage and root folder.

Q2: Can I delete OLE objects from a specific cell only?
A: This endpoint deletes all OLE objects in the worksheet. To remove a single object, use the Delete a specific OLE object operation.

Q3: What happens if the workbook is locked for editing?
A: The API will return 400 Bad Request with a message indicating the file is locked. Ensure the file is not opened elsewhere before calling the endpoint.

Q4: Is there a size limit for the workbook?
A: The service follows the general Aspose Cloud file size limits (currently up to 2 GB per file). Larger files may need to be split or processed in chunks.


Best Practices


Use the navigation links at the bottom of the page to move between related API actions.