UpdateExcelCell Activity
Purpose: This activity updates a specific cell in an Excel file. You can specify the worksheet name, cell address, and value to update. This is useful for modifying individual cells in existing Excel files without reading and rewriting the entire file.
Input Properties
The full path to the Excel file. This must be an existing Excel file that is accessible and writable.
Type: string
Required: Yes
Example: "C:\Data\Workbook.xlsx"
The name of the worksheet to update. If empty or not specified, defaults to the first sheet in the workbook.
Type: string
Required: No
Example: "Sheet1" or "Data" or leave empty for first sheet
Note: If not specified, the first sheet in the workbook will be used.
The cell address in standard Excel format (e.g., 'A1', 'B2', 'Z100').
Type: string
Required: Yes
Example: "A1", "B2", "Z100"
The value to set in the cell. Can be a string, number, or other object type.
Type: object
Required: Yes
Example: "Text Value", 123, 45.67
Output Properties
True if the cell was updated successfully, false otherwise.
Type: bool
Note: Returns false if the FilePath is null or empty, if CellAddress is null or empty, if the file does not exist, if the sheet is not found, if the cell cannot be updated, or if an error occurs.
Usage Example
Scenario: Update a cell in an Excel file Configuration: - FilePath: "C:\Data\Workbook.xlsx" - SheetName: "Sheet1" - CellAddress: "A1" - Value: "Updated Value" Result: - Success: true Scenario: Update cell in first sheet (default) Configuration: - FilePath: "C:\Data\Workbook.xlsx" - SheetName: "" (empty, uses first sheet) - CellAddress: "B2" - Value: 123 Result: - Success: true
Error Handling
Important: The activity handles errors gracefully:
- If
FilePathorCellAddressis null or empty,Successwill befalse - If the file does not exist,
Successwill befalse - If the specified sheet is not found,
Successwill befalse - If the cell cannot be updated (e.g., file is read-only, locked by another process),
Successwill befalse - If any exception occurs,
Successwill befalse - The activity does not throw exceptions - errors are indicated by the
Successoutput
Always check the Success output to verify if the cell was updated successfully.
Important Notes
- The FilePath must point to an existing Excel file that is accessible and writable
- The file must not be locked by another process (e.g., open in Excel)
- If SheetName is not specified, the first sheet in the workbook will be used
- The CellAddress must be in standard Excel format (e.g., "A1", "B2")
- The Value will be written as-is to the cell - formatting is preserved from the file
- This activity modifies the existing file - consider backing up important files before updating
- Use ReadExcelFile to read the file after updating to verify changes
Related Activities
- ReadExcelFile - Read data from an Excel file
- WriteExcelFile - Write data to an Excel file
- CleanExcelNewlines - Clean newlines from Excel cells