> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-en/action-guides/file-and-folder/file-write-all-text.md).

# File write all text

File write all text is the action used to write a string of text to a `.txt` file on the computer.

This action has a special operating mechanism (overwrite and auto-create):

* If the file does not exist: The system will automatically create a new `.txt` file at the specified path and then write the content into it.
* If the file already exists: The system will completely clear all existing content in the file and overwrite it with the new content.

#### Configuration parameters:

* File Path: The absolute path to the `.txt` file you want to write data to (e.g., `D:\GPM\status.txt`).
* Text: The raw text content (or a variable containing text) that you want to write to the file.

#### Practical example: Automatically create a new status report file

Suppose you start running a script to interact with a new account at the beginning of the day. You want the script to automatically clean (or create) a text file named `report.txt` on drive D, and then write the first welcome line into it to prepare for logging today.

* How to configure:
  * Call the File write all text action.
  * File Path: Enter `D:\GPM\report.txt`.
  * Text: Enter the content: `"--- Log of today's script run ---"`.
* Result:
  * If the `report.txt` file does not exist, the system will automatically create this file in the `D:\GPM\` directory.
  * If the file has been available since yesterday (filled with old text), the system will clear all that old content, turning the file into a blank file, and then write the line `"--- Log of today's script run ---"` into it.

<figure><img src="/files/WaeW1PyODrUEH0uUepmm" 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 dynamically by asking a question.

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

```
GET https://docs.gpmautomate.com/automate-en/action-guides/file-and-folder/file-write-all-text.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
