Delete worksheet from Excel file using n8n action
PDF4me Delete Worksheets from Excel removes one or more worksheets from Excel workbooks through n8n automation workflows. Process Excel files via n8n triggers, binary data, base64 strings, or public URLs to delete worksheets by name or index with automatic validation ensuring at least one worksheet always remains (Excel requirement). This solution is ideal for template cleanup, removing temporary sheets, automated workbook maintenance, and document preparation workflows that require worksheet removal with safety checks and seamless integration.
Setup
Add the PDF4me "Delete Worksheets" node to your n8n workflow and configure the required parameters. For initial setup instructions, see our n8n Integration Guide.
Prerequisites:
- PDF4me API credentials
- n8n workflow access
Configuration:
- Add PDF4me node to workflow
- Select "Delete worksheet from Excel file" action
- Configure input parameters (see below)

Parameters
Complete list of parameters for the Delete Worksheets action. Configure these parameters to control worksheet deletion.
Important: Parameters marked with an asterisk (***) are required. At least one worksheet must remain after deletion (Excel requirement). Worksheet indexes use 0-based numbering.
| Parameter | Type | Description | Example |
|---|---|---|---|
| Input Data Type*** | String | Excel Input Format Selection • Choose the format of your Excel data input • PDF4me supports multiple input types • Options: Binary Data, Base64 String, or URL | Binary Data |
| Input Binary Field*** | Binary | Binary Excel File Input (Required if Binary Data) • Reference Excel file (.xlsx, .xls) from previous n8n node or file upload • PDF4me processes binary Excel files with automatic format detection • Required when Input Data Type is "Binary Data" | {{ $binary.data }} |
| Base64 Excel Content*** | String | Base64 Encoded Excel Input (Required if Base64 String) • Provide Excel content (.xlsx, .xls) as base64 encoded string • PDF4me automatically decodes and processes the Excel content • Required when Input Data Type is "Base64 String" | UEsDBBQABgAI... |
| Excel URL*** | String | Public Excel URL Input (Required if URL) • Provide a public/open permission URL to the Excel file (.xlsx, .xls) • PDF4me downloads and processes the Excel file from the provided URL • Required when Input Data Type is "URL" | https://abc.com/data.xlsx |
| Excel Name*** | String | Excel Input Filename • Specify the name of the input Excel file with proper extension (.xlsx, .xls) • PDF4me uses this for format detection and processing optimization | data.xlsx |
| Worksheet Names | String | Comma-Separated Worksheet Names • List of worksheet names to delete • Format: "Sheet1,Temp,Old" • Selection Logic: If provided → Delete those named worksheets. If both parameters provided → Delete worksheets matching EITHER (union). Duplicates handled - same worksheet deleted only once • Case-sensitive worksheet names | Temp,Draft,Old |
| Worksheet Indexes | String | Comma-Separated Indexes (0-based) • List of worksheet indexes to delete • Format: "0,2,5" (Index 0 = first sheet, Index 1 = second sheet, etc.) • Selection Logic: If provided → Delete those indexed worksheets. Valid range: 0 to (Total Worksheets - 1) • 0-based indexing: Index 0 = first worksheet • Critical Rule: At least 1 worksheet must remain after deletion (Excel requirement) | 0,2 |
| Binary Data Output Name*** | String | Binary Data Output Mapping • Define the variable name for accessing generated Excel binary data • Used in subsequent workflow actions • Essential for workflow automation | document |
Output
Output Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| fileName | String | Excel document filename with worksheets deleted - The name of the output Excel document file after worksheet deletion | excel_worksheet_deleted.xlsx |
| fileSize | Number | File size in bytes - The size of the Excel document in bytes after worksheet deletion | 171937 |
| success | Boolean | PDF4me operation status - Boolean flag indicating the success or failure of the worksheet deletion process. PDF4me returns true for successful deletions and false for any errors | true |
| originalFileName | String | Original Excel document filename - The name of the input Excel document file | myExcelFile.xlsx |
| deleteBy | String | Deletion method - The method used to identify worksheets for deletion. Values: "name" if deleted by worksheet names, "index" if deleted by worksheet indexes | name |
| worksheetNames | String | Worksheet names deleted - Comma-separated list of worksheet names that were deleted | Sheet2 |
| message | String | Operation message - Descriptive message indicating the result of the worksheet deletion operation, including the worksheet names and deletion method | Successfully deleted worksheet(s) 'Sheet2' by name |
N8N Action Response
The PDF4me Delete worksheet from Excel file API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:
- JSON
- Table
- Schema
- Binary
JSON Response Format
The raw JSON response from the API:
[
{
"fileName": "excel_worksheet_deleted.xlsx",
"fileSize": 171937,
"success": true,
"originalFileName": "myExcelFile.xlsx",
"deleteBy": "name",
"worksheetNames": "Sheet2",
"message": "Successfully deleted worksheet(s) 'Sheet2' by name"
}
]
Table View
Response data in a structured table format:
| Parameter | Value |
|---|---|
| fileName | excel_worksheet_deleted.xlsx |
| fileSize | 171937 |
| success | true |
| originalFileName | myExcelFile.xlsx |
| deleteBy | name |
| worksheetNames | Sheet2 |
| message | Successfully deleted worksheet(s) 'Sheet2' by name |
Schema View
The data structure and types of the response:
1 item
fileName: T excel_worksheet_deleted.xlsx
fileSize: # 171937
success: ☑ true
originalFileName: T myExcelFile.xlsx
deleteBy: T name
worksheetNames: T Sheet2
message: T Successfully deleted worksheet(s) 'Sheet2' by name
Type Indicators:
T= String (Text)#= Number☑= Boolean[]= Array
Binary Data View
The actual Excel document file data and metadata:
data
─────────────────────────────
File Name: excel_worksheet_deleted.xlsx
File Extension: xlsx
Mime Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
File Size: 172 kB
Binary Data Access:
- n8n Binary Object:
$binary.data.data - Base64 Content: Available for direct use
- File Operations: Ready for download, email, or storage
Use Cases
Template Cleanup and Maintenance
- Remove temporary or sample worksheets from Excel templates before distribution
- Clean up old or unused worksheets from workbooks to reduce file size
- Prepare templates for new use by removing example data sheets
Document Preparation and Standardization
- Remove internal review worksheets before client delivery
- Delete backup or archive sheets from production workbooks
- Standardize workbook structure by removing unnecessary worksheets
Automated Workbook Management
- Remove worksheets based on date or status criteria in automated workflows
- Clean up worksheets after data migration or consolidation operations
- Maintain workbook organization by removing duplicate or redundant sheets