Set Cell Value
Sets the value of a cell in an Excel spreadsheet.
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 - The Excel file descriptor ID. This ID is generated by the Open Excel or the Create Excel node.
- Cell - The cell address in which to set the value. (e.g.
C3) - Value - The value to set in the cell.
Options
-
Target - The target location where to set the value. Available options are "Active Cell" or "Specific Cell".
-
Format - The format of the value to set in the cell. Available options are "String", "Number", "DateTime", "Boolean".
Notes:
- If the target is set to "Active Cell" then the input for "Cell" will be ignored.
How It Works
- Validates Input: Checks that file descriptor and format are provided
- Retrieves Handle: Gets the Excel file handle from the descriptor
- Processes Value: Converts the input value based on the selected format:
- String: Keeps value as text
- Number: Parses as floating-point number
- Boolean: Converts to true/false
- DateTime: Parses in "YYYY-MM-DD HH:MM" format
- Determines Cell: Based on target option, uses either active cell or specified cell
- Sets Active Cell: If specific-cell, sets it as the new active cell
- Writes Value: Updates the cell with the formatted value
- Persists in Memory: Changes are stored in memory until Save Excel is called
Requirements
- The Excel file must be opened with Open Excel or created with Create Excel
- A valid file descriptor must be provided
- When using specific-cell target, a valid cell reference must be provided
- Format must be selected (string, number, bool, or datetime)
- DateTime values must be in "YYYY-MM-DD HH:MM" format
- File must be saved to persist changes
Error Handling
| Error Code | Description | Solution |
|---|---|---|
| Core.Excel.SetCellValue.ErrOnCreate | Configuration parsing failed | Check node configuration is valid |
| Core.Excel.SetCellValue.OnMessage | Message parsing failed | Verify input message format |
| Core.Excel.SetCellValue.ErrFileDescriptor | File descriptor is empty or doesn't exist | Ensure file is opened/created before setting value |
| Core.Excel.SetCellValue.ErrFormat | Format not selected or value doesn't match format | Select format and provide matching value |
| Excel.SetCellValue.ErrDateType | Invalid datetime format | Use "YYYY-MM-DD HH:MM" format |
| Excel.SetCelllValue.InvalidCell | Cell reference is invalid | Provide valid cell reference (e.g., A1) |
| Excel.SetCelllValue.ErrSetActiveCell | Failed to set active cell | Verify cell reference is valid |
| Excel.SetCelllValue.ErrSetValue | Failed to set cell value | Check value is compatible with Excel |
Usage Examples
Example 1: Set String Value
Write text to a specific cell:
- Open Excel (data.xlsx) -> fileDesc
- Set Cell Value:
- Excel File Descriptor: fileDesc
- Cell: "A1"
- Value: "Customer Name"
- Target: specific-cell
- Format: string
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Example 2: Set Number Value
Write a numeric value:
- Open Excel (report.xlsx) -> fileDesc
- Set Cell Value:
- Excel File Descriptor: fileDesc
- Cell: "B5"
- Value: 12345.67
- Target: specific-cell
- Format: number
- Save Excel (fileDesc)
Example 3: Set Boolean Value
Write true/false values:
- Open Excel (status.xlsx) -> fileDesc
- Set Cell Value:
- Excel File Descriptor: fileDesc
- Cell: "C2"
- Value: true
- Target: specific-cell
- Format: bool
- Save Excel (fileDesc)
Example 4: Set DateTime Value
Write a date and time:
- Open Excel (schedule.xlsx) -> fileDesc
- Set Cell Value:
- Excel File Descriptor: fileDesc
- Cell: "D3"
- Value: "2025-12-23 14:30"
- Target: specific-cell
- Format: datetime
- Save Excel (fileDesc)
Example 5: Set Active Cell Value
Write to the currently active cell:
- Open Excel (worksheet.xlsx) -> fileDesc
- Set Active Cell (fileDesc, "E10")
- Set Cell Value:
- Excel File Descriptor: fileDesc
- Value: "Active Cell Content"
- Target: active-cell
- Format: string
- Save Excel (fileDesc)
Usage Notes
- Changes are not persisted until Save Excel is called
- When using specific-cell target, that cell becomes the new active cell
- The format option must match the value type you're providing
- DateTime format must be exactly "YYYY-MM-DD HH:MM" (24-hour format)
- Boolean values can be "true" or "false" as strings
- Number format accepts integers and decimals
- Setting a value to an existing cell overwrites the previous content
- Cell formatting (colors, borders) is preserved when setting values
Tips
- Always select the appropriate format to ensure data is stored correctly
- Use string format for mixed alphanumeric content
- Use number format for calculations and numeric operations
- For dates, use datetime format to enable Excel's date functions
- When setting multiple cells, consider using Set Range for better performance
- Validate data types before setting to avoid format errors
- Remember to save the file to persist your changes
- Use active-cell target when iterating through cells sequentially
Related Nodes
- Get Cell Value - Read cell values
- Set Active Cell - Change active cell
- Set Range - Set multiple cells at once
- Set Formula - Set Excel formulas
- Save Excel - Persist changes to disk