Replace Action: replace
The replace action in the CSVHandle function allows you to find and replace specific text within a specified column in a CSV file. The updated file is saved at the specified output path. This action is useful for data cleanup and ensuring consistency in CSV datasets.
Note: Ensure that the file being used is not open during the execution of the Case to avoid errors or conflicts.
Example: Suppose you have a CSV file named EmployeeRecords.csv, located at C:\Data, with the following data:

You want to replace the text “Sales” with “Marketing” in the Department column and save the updated file as UpdatedEmployeeRecords.csv.
Steps to Configure:
- Select Set a Variable Value from the Action dropdown.
- Enter a variable name in the Element Key field (e.g., ReplaceStatus). This variable will store the result of the operation (true if successful, false if not).
- Click on Form, select Functions, and choose CSVHANDLE.
- In the Cmd field, select replace and provide the following parameters:
- FPath: Specify the path to the source CSV file (e.g., C:\Data\EmployeeRecords.csv).
- OutPath: Specify the path to save the updated file (e.g., C:\Data\UpdatedEmployeeRecords.csv).
- ColumnName: Enter the name of the column to perform the replacement (e.g., Department).
- ExistingText: Specify the text to be replaced (e.g., Sales).
- ReplaceText: Specify the new text to replace the old one (e.g., Marketing).
- Click Save.


Outcome on Execution:
- The action searches for the text “Sales” in the Department column and replaces it with “Marketing”.
- The updated CSV file is saved at the location specified in the OutPath parameter (e.g., C:\Data\UpdatedEmployeeRecords.csv).

- If the operation is successful, the variable (e.g., ReplaceStatus) stores true. If the operation fails (e.g., invalid file path or column name), the variable stores false.
- This variable can be referenced in subsequent steps using the syntax ${VariableName} (e.g., ${ReplaceStatus}).