> For the complete documentation index, see [llms.txt](https://docs.avoautomation.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avoautomation.com/avo-assure/actions/generic/file-and-folder-operations/replace-content.md).

# 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="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FtZtQyD5MINshthlCjTEC%2Fimage.png?alt=media&amp;token=d6b1f4e4-0c96-4843-aa49-91b32dbcc323" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FUEUuy5BWajaS7oTAs6Re%2Fimage.png?alt=media&amp;token=3da839a7-3f32-4c96-bc3f-a26153906642" 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="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FLT0rdb7rRZpu4y8WzYkf%2Fimage.png?alt=media&amp;token=98da450f-2ab1-452a-bf54-b3fcb3c1ce94" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FzUqMS9oHdvaS0FyfKn2e%2Fimage.png?alt=media&amp;token=6764a9fb-2dfa-4d88-b21d-7c55b6bd2f24" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
