Delete Worksheets - Excel API
PDF4me Delete Worksheets enables you to remove worksheets from Excel workbooks by name or index. This API service processes Excel files and deletes specified sheets. The API receives Excel document content through REST API calls, utilizing Base64 encoding for secure transmission. This solution is ideal for workbook cleanup, template preparation, and automated Excel editing workflows.
Authenticating Your API Request
Include your API key in the request to authenticate with the PDF4me REST API.
Key Features
- Worksheet Removal: Delete one or more worksheets by name or index
REST API Endpoint
- Method: POST
- Endpoint:
office/ApiV2Excel/ExcelDeleteWorksheet
REST API Parameters
Important: Parameters marked with an asterisk (*) are required. All requests use document, docContent, and deleteWorksheetToExcelAction. Operation-specific parameters (worksheetNames, worksheetIndexes, 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... |
| deleteWorksheetToExcelAction* | Object | Action configuration (worksheet names or indexes to delete) | See Payload example below |
Optional Parameters (inside deleteWorksheetToExcelAction)
| Parameter | Type | Description | Example |
|---|---|---|---|
| worksheetNames | Array (string[]) | Worksheet names to delete | ["Sheet2", "Sheet3"] |
| worksheetIndexes | Array (int[]) | Worksheet indexes to delete (0-based or 1-based per API spec) | [1, 2] |
| cultureName | String | Culture code for processing | en-US |
Output
The API returns the 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...",
"deleteWorksheetToExcelAction": {
"worksheetNames": ["Sheet2", "Sheet3"]
}
}