---
schema_version: "1"
id: 5450b9641316e4d01f8f0e4a2af7af7b22dd5ab5a3bdac602dd5e341f6afe6fd
title: Write to Text File
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/rpa-builder/6.6/toolbox-file-operations-write-to-text-file.md
canonical_url: https://docs.mulesoft.com/rpa-builder/6.6/toolbox-file-operations-write-to-text-file
source_site: docs.mulesoft.com
content_type: documentation
content_hash: f3933d4b931528664c1351c8fbc6ccb198505db4ba6f094df34531a041f7181b
description: MuleSoft Documentation Site
release: "6.6"
latest: false
---
---
product: RPA Builder
version: 6.6
---

# Write to Text File

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

_Write to Text File_ writes text to a plain text file, with `.txt` as the only supported file
format. You can specify if you want _Write to Text File_ to overwrite existing text in a file or
create a new file.

## Properties

**File Operation Settings:**

- **Add new line** Specify here whether a new line should be added after the new text.

- **Create if file does not exist** Specify here whether a new file should be created if the
  specified file does not exist. This option prevent the _Workflow_ from ending with an error
  message if the file does not exist.

- **Directory path** Enter the path to the directory where the file to be written to is stored. You
  can specify an absolute or relative path. If a relative path is used, then the path refers to a
  storage location relative to the _Base Path_ variable.

- **File name** Enter the name of the file that is to be written.

- **Overwrite file content** Specify here whether the whole content of the destination file is to be
  deleted before writing. This option can be used if you want the specified file to contain only the
  text that is to be written. If this option is not selected, the new text will be appended at the
  end of the existing text.

- **Text to write** Specify here the text that is to be written.

Other Properties that are the same in all Action Steps are described in the section on **Common
Properties**. For reasons of clarity they are not shown here.

## Inbound Variables

**Directory path** Enter the path to the directory where the file to be written to is stored. You
can specify an absolute or relative path. If a relative path is used, then the path refers to a
storage location relative to the _Base Path_ variable.

**File name** Enter the name of the file that is to be written.

**Text to write** Specify here the text that is to be written.

## Outbound Variables

**Text to write** The _Write to Text File.Text to write_ provides the text that is to be written.

**IsWritten** The _Write to Text File.IsWritten_ variable indicates whether the text could be
written to the file or not (True/False).

**File name** The _Write to Text File.File Name_ variable provides the name of the file that is to
be written.

**Directory path** The _Write to Text File.Directory Path_ variable provides the path used.

## Wizard

- **Directory path** Specify the path here to the file that is to be written. You can create an
  absolute path or a path relative to the _Base Path_. The initial value is %STWS\_BASEPATH%. Select
  an existing path. You can also insert variables from the _Workflow_ in order to construct the
  path. To do so, click on the pin and select one of the available variables.

- **File name** Enter the name of the file that is to be written. You can also insert a variable
  from the Workflow as the _File Name_. To do so, click on the pin and select one of the available
  variables.

- **Text to write** Enter the text that is to be written. You can also insert a variable from the
  Workflow as the _Text to write_. To do so, click on the pin and select one of the available
  variables.

- **Overwrite content with text** Specify here whether the whole content of the destination file is
  to be deleted before writing. This option can be used if you want the specified file to contain
  only the text that is to be written. If this option is not selected, the new text will be appended
  at the end of the existing text.

- **Add a new line after text** Specify here whether a new line should be added after the new text.

- **Create file if it does not exist** This option determines whether a new file should be created
  if the specified file does not exist. This option prevents the _Workflow_ from ending with an
  error message if the file does not exist.

- **Encoding** The encoding to use when writing the file. Includes Shift-JIS and EUC-JP for Japanese
  support. Specify a valid encoding type if the one you need is not in the list.
