> 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/writetofile.md).

# writeToFile

This pre-built Action located under the **@Generic Element,** instructs Avo Assure to write given content in the file whose file path is provided in Input Value and save the result in dynamic variable.

### **Syntax**

**Input Value:** `<file path>;<Sheetname>(Optional);<Content to write>;<Newline>`

{% hint style="warning" %}
Supported file formats: .txt, .xls/.xlsx, .XML/JSON
{% endhint %}

| Argument                                 | Description                                                                              |
| ---------------------------------------- | ---------------------------------------------------------------------------------------- |
| <p>\<File path></p><p>(Required)</p>     | Provide file path where the content should be written.                                   |
| <p>\<Sheet name><br>(Optional)</p>       | Specify the Excel sheet name where the content should be written.                        |
| <p>\<Content to write><br>(Required)</p> | Provide text or string that needs to be write into the file.                             |
| <p>\<Newline><br>(Required)</p>          | Provide the text as **Newline** to move the cursor to a new line before writing the text |

**Output Value:**

| Argument                                                    | Description                                              |
| ----------------------------------------------------------- | -------------------------------------------------------- |
| \<Dynamic Variable>(Optional);\<Dynamic Variable>(Optional) | This variable stores the status as **true** or **false** |

**Example 1**

**Write content to a specified text file**\
\
The **writeToFile** action writes the specified content to the file path provided in the Input Value column (e.g., **C:\sam\sample.txt;New order is preparing**). The file is updated with the new content. The action status is saved in the **{Status}** variable with the following possible values:

* **True** – if the content is written to the file successfully
* **False** – if the content is not written

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2Ft4ZGlEhtrW57rhwYczpr%2Fimage.png?alt=media&amp;token=457c9f12-43be-4a67-bdb1-3a282432905a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FaCPZdSka3MzsXhZIKVP2%2Fimage.png?alt=media&amp;token=737f8ff0-0b9a-423b-bcee-18d20b85d75f" alt=""><figcaption></figcaption></figure>

**Example 2**

**Write content to a specified sheet in a Excel file**\
\
The **writeToFile** action writes the specified content to the given sheet in the file path provided in the Input Value column (e.g., **‪C:\sam\OR ID.xlsx;Sheet2;ORD10005;Newline**). The action status is saved in the **{Status}** variable with the following possible values:

* **True** – if the content is written to the specified sheet successfully
* **False** – if the content is not written

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FSYQiWrh5yh56XfmVqJ5l%2Fimage.png?alt=media&amp;token=880e564f-1586-49fe-9eb4-20e6a51fd17d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FuvpC6BoADXNegpqLOql5%2FScreenshot%202025-05-23%20125910.png?alt=media&amp;token=d5bdc665-e56f-442a-8f28-51918679a8ea" 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/writetofile.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.
