Replace Content

This is pre-built Action located under the @Generic Element, instructs the Avo Assure to replace the content in the file with provided content and save the result in the given dynamic variable.

Syntax

Input Value:

For .txt File: <file path>;<content to replace>;<content>

Argument
Description

<file path>

(Required)

Specify the file path of the file where the content should be replace Supported files - .txt file (Note: The file must exist and be readable )

<content to replace> (Required)

The content which needs to be changed or replaced

<content>

(Required)

The string which needs to be updated

For .xls, .xlsx File: <file path>;<sheetnumber>;<content to replace>;<content>

Argument
Description

<file path>

(Required)

Specify the Excel file path of the file where the content should be replace

Supported file - .xls,.xlsx file (Note: The file must exist and be readable )

<sheetnumber> (Required)

Provide the sheet number of the excel file

<content to replace> (Required)

The exact text string that needs to be found and replaced.

<content>

(Required)

The new text that should replace the old content.

Output Value:

Argument
Description

<Dynamic Variable>;<Dynamic Variable> (Optional)

This variable stores the status as true or false

Example 1

Replace specific content in a file [ For .txt File ] The Replace Content action takes the value from the Input Value column (e.g., C:\Files\orderno.txt;order no276;order no 350) and replaces the specified text (order276) with new content (oderno350) in the given file. The action status is saved in the {Status} variable with the following possible values:

  • True – if the content is replaced successfully

  • False – if the content is not replaced

Example 2

Replace specific content in a Excel file The Replace Content action takes the value from the Input Value column (e.g., C:\Files\username.xlsx;1;John Doe;Jhon white) and replaces the specified text (John Doe) with new content (Jhon White) in the given file. The action status is saved in the {Status} variable with the following possible values:

  • True – if the content is replaced successfully

  • False – if the content is not replaced

Last updated

Was this helpful?