> 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-guide/file-and-folder/file-write-all-text.md).

# File write all text

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

🎥 Watch the tutorial video: [Here](https://youtu.be/EH7olDLAb9c).

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 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 where you want to write data (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 for a new account interaction 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.

* Configuration steps:
  * 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 ---"`.

<figure><img src="https://2961903581-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpIRrmOLZkhHBXdAiidIw%2Fuploads%2Fgit-blob-0d7918e365995f59ba2fccf5b860913e6008cc77%2Fff-07.png?alt=media" 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.gpmautomate.com/automate-en/action-guide/file-and-folder/file-write-all-text.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.
