Create Sheet
Creates a new sheet in an existing Excel file.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.
Input
- Excel File Descriptor - ID of the Excel file to add the new sheet to. This ID is generated by the Open Excel or the Create Excel node.
- Sheet - The name of the new sheet to create.
Output
- Excel File Descriptor - ID of the updated Excel file containing the new sheet.
Options
- Switch To Sheet - If true, the newly created sheet will be selected after it is created. If false, no changes in sheet selection will be made.
How It Works
- Validates Input: Checks that both file descriptor and sheet name are provided and not empty
- Verifies Handle: Confirms that the file descriptor exists and corresponds to an open Excel file
- Checks Existence: Verifies that a sheet with the same name doesn't already exist in the file
- Creates Sheet: Creates a new blank sheet with the specified name in the Excel file
- Switches Sheet (Optional): If Switch To Sheet is enabled, activates the newly created sheet at cell A1
- Returns Descriptor: Outputs the same file descriptor for continued operations
Requirements
- The Excel file must be opened with Open Excel or created with Create Excel
- The sheet name must be unique within the workbook
- Sheet name must not be empty
- The file must be saved after creating the sheet to persist changes
Error Handling
| Error Code | Description | Solution |
|---|---|---|
| Core.Excel.CreateSheet.ErrOnCreate | Configuration parsing failed | Check node configuration is valid |
| Core.Excel.CreateSheet.ErrOnMessage | Message parsing failed | Verify input message format |
| Core.Excel.CreateSheet.ErrFileDescriptor | File descriptor is empty | Ensure file is opened/created before creating sheet |
| Core.Excel.CreateSheet.ErrSheet | Sheet name is empty or already exists | Provide a unique, non-empty sheet name |
| Core.Excel.CreateSheet.ErrSwitch | Failed to switch to new sheet | Verify the sheet was created successfully |
| Core.Excel.CreateSheet | Sheet creation failed | Check file handle and permissions |
Usage Examples
Example 1: Create Multiple Report Sheets
Create separate sheets for different departments:
- Create Excel -> workbook
- Create Sheet:
- Excel File Descriptor: workbook
- Sheet: "Sales"
- Switch To Sheet: true
- Set Range (workbook, "A1:C1", ["Product", "Quantity", "Revenue"])
- Create Sheet:
- Excel File Descriptor: workbook
- Sheet: "Marketing"
- Switch To Sheet: true
- Set Range (workbook, "A1:C1", ["Campaign", "Reach", "Conversion"])
- Save Excel (workbook, "departments.xlsx")
- Close Excel (workbook)
Example 2: Dynamic Sheet Creation
Create sheets based on data categories:
- Open Excel (template.xlsx) -> file
- For each category in ["Q1", "Q2", "Q3", "Q4"]:
- Create Sheet:
- Excel File Descriptor: file
- Sheet: {{category}}
- Switch To Sheet: true
- Set Cell Value (file, "A1", "{{category}} Results")
- // Add quarter-specific data
- Save Excel (file)
- Close Excel (file)
Example 3: Add Summary Sheet
Add a summary sheet to an existing workbook:
- Open Excel (sales_data.xlsx) -> salesFile
- Create Sheet:
- Excel File Descriptor: salesFile
- Sheet: "Summary"
- Switch To Sheet: true
- Set Cell Value (salesFile, "A1", "Sales Summary Report")
- Set Formula (salesFile, "A3", "=SUM(Sheet1!A:A)")
- Save Excel (salesFile)
- Close Excel (salesFile)
Usage Notes
- The newly created sheet is blank and has no data or formatting initially
- Sheet names must be unique within a workbook - you cannot create two sheets with the same name
- Excel has naming restrictions: sheet names cannot exceed 31 characters and cannot contain: \ / ? * [ ]
- If Switch To Sheet is false, the currently active sheet remains active
- The new sheet is added to the end of the sheet list in the workbook
- Remember to save the file after creating sheets to persist the changes
- The same file descriptor is returned as output for chaining operations
Tips
- Use descriptive sheet names that clearly indicate the content or purpose
- Enable Switch To Sheet when you plan to immediately add data to the new sheet
- Create all sheets first, then populate them with data for better workflow organization
- Validate sheet names before creating to avoid special characters that Excel doesn't allow
- Use Get Sheets before creating to verify the sheet doesn't already exist
- Consider a naming convention for sheets in automated processes (e.g., "Report_2025_01")
- Keep sheet names under 31 characters to comply with Excel's limits
Related Nodes
- Copy Sheet - Duplicate an existing sheet with content
- Switch To Sheet - Change the active sheet
- Get Sheets - List all sheets in the workbook
- Set Range - Add data to the new sheet
- Save Excel - Persist the new sheet to disk
- Create Excel - Create a new Excel file