# 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>`&#x20;

{% 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:**&#x20;

| 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="/files/tyrXwS6f53yHo1Jiqs1r" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/afCSL8vttSJ372ebUmii" 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="/files/yhxxTQKD4GveDgbT1yJj" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/zFhLHdS0684gGgteX6jS" 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/writetofile.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.
