# 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                                                                                                                                                                                             |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>\<file path></p><p>(Required)</p>       | <p>Specify the file path of the file where the content should be replace <br>Supported files - <strong>.txt file</strong><br><em>(<strong>Note:</strong> The file must exist and be readable )</em></p> |
| <p>\<content to replace><br>(Required)</p> | The content which needs to be changed or replaced                                                                                                                                                       |
| <p>\<content></p><p>(Required)</p>         | The string which needs to be updated                                                                                                                                                                    |

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

| Argument                                   | Description                                                                                                                                                                                                          |
| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>\<file path></p><p>(Required)</p>       | <p>Specify the Excel file path of the file where the content should be replace</p><p>Supported file - <strong>.xls,.xlsx file</strong><br><em>(<strong>Note:</strong> The file must exist and be readable )</em></p> |
| <p>\<sheetnumber><br>(Required)</p>        | Provide the sheet number of the excel file                                                                                                                                                                           |
| <p>\<content to replace><br>(Required)</p> | The exact text string that needs to be found and replaced.                                                                                                                                                           |
| <p>\<content></p><p>(Required)</p>         | The new text that should replace the old content.                                                                                                                                                                    |

**Output Value:**

| Argument                                                     | Description                                              |
| ------------------------------------------------------------ | -------------------------------------------------------- |
| <p>\<Dynamic Variable>;\<Dynamic Variable><br>(Optional)</p> | 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

<figure><img src="/files/rb8c0OXC9Ata5Y3Kk38k" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/49CBTLBKdZqhQVIVPLYV" alt=""><figcaption></figcaption></figure>

**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

<figure><img src="/files/f8t5YscGIevFMVzRsc86" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/D6Qnxo7NmOdQpTqXglYB" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avoautomation.com/avo-assure/actions/generic/file-and-folder-operations/replace-content.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
