# 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="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FIzfD1QQtP2PimCciQhHU%2Fimage.png?alt=media&#x26;token=54619cc1-72f7-42e5-be62-42b828f30947" 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&#x26;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&#x26;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&#x26;token=d5bdc665-e56f-442a-8f28-51918679a8ea" alt=""><figcaption></figcaption></figure>
