# Text File Output

The **Text File Output** step exports rows to a text file.

This step is commonly used to generate delimited files (for example, CSV) that can be read by spreadsheet applications, and it can also generate fixed-length output.

{% hint style="warning" %}
You can’t run this step in parallel to write to the **same** file.

If you need to run multiple copies, select **Include stepnr in filename** and merge the resulting files afterward.
{% endhint %}

### Step name

**Step name** specifies the unique name of the step on the canvas. You can change it.

### Configure the step (tabs)

The **Text File Output** step includes these tabs:

* **File**
* **Content**
* **Fields**

#### File tab

Use the **File** tab to define where and how files are created.

| Option                                | Description                                                                                                                                                                                                                                                                                                                                   |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Filename**                          | Output file path and name. Select **Browse** to locate a file or folder. For supported file system types, see [Connecting to Virtual File Systems](https://docs.pentaho.com/pdia-data-integration/extracting-data-into-pdi/virtual-file-system-browser). Do not include a file extension when date/time is appended and **Extension** is set. |
| **Pass output to servlet**            | Returns output using a web service instead of writing to a file. See [Web services steps](https://docs.pentaho.com/pdia-data-integration/extracting-data-into-pdi/web-services-steps).                                                                                                                                                        |
| **Create parent folder**              | Clear if you do not want to create the parent folder automatically.                                                                                                                                                                                                                                                                           |
| **Do not create file at start**       | Avoids creating empty files when no rows are processed.                                                                                                                                                                                                                                                                                       |
| **Accept file name from field?**      | Uses file name(s) from the incoming stream, based on **File name field**. For performance tuning when writing multiple files, see [Improving performance when writing multiple files](https://docs.pentaho.com/pdia-data-integration/data-integration-issues/improving-performance-when-writing-multiple-files).                              |
| **File name field**                   | Incoming field containing the output file name at runtime.                                                                                                                                                                                                                                                                                    |
| **Extension**                         | File extension to append. Default: `.txt`.                                                                                                                                                                                                                                                                                                    |
| **Include stepnr in filename?**       | Adds the copy number (for example, `_0`) when running multiple copies of the step.                                                                                                                                                                                                                                                            |
| **Include partition nr in filename?** | Adds the partition number to the file name.                                                                                                                                                                                                                                                                                                   |
| **Include date in filename?**         | Adds the system date to the file name (for example, `_20181231`).                                                                                                                                                                                                                                                                             |
| **Include time in filename?**         | Adds the system time to the file name (for example, `_235959`).                                                                                                                                                                                                                                                                               |
| **Specify Date time format**          | Adds a date/time stamp using **Date time format**.                                                                                                                                                                                                                                                                                            |
| **Date time format**                  | Date/time format to use when appending date/time.                                                                                                                                                                                                                                                                                             |
| **Add filenames to result**           | Clear if you do not want to add output file names to the transformation result file list.                                                                                                                                                                                                                                                     |

Select **Show filename(s)** to simulate and display the list of files that will be generated.

#### Content tab

Use the **Content** tab to define output formatting.

| Option                                 | Description                                                                                                   |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **Append**                             | Appends rows to the end of the file.                                                                          |
| **Separator**                          | Field delimiter (commonly semicolon or tab). Select **Insert Tab** to insert a tab character. Default: `;`.   |
| **Enclosure**                          | Encloses fields so separator characters can appear inside field values. Optional; default is `"`.             |
| **Force the enclosure around fields?** | Forces enclosure for all fields.                                                                              |
| **Disable the enclosure fix?**         | Disregards enclosures on string fields and separators.                                                        |
| **Header**                             | Clear if you do not want a header row.                                                                        |
| **Footer**                             | Adds a footer row. When **Append** is selected, existing footers can’t be stripped before appending new rows. |
| **Format**                             | Line ending format: **DOS** or **UNIX**. Default: `CR + LF` (Windows/DOS).                                    |
| **Compression**                        | Output compression: `.ZIP` or `GZip`. Only one file is placed in a single archive. Default: None.             |
| **Encoding**                           | File encoding. Leave blank to use the system default. To use Unicode, specify `UTF-8` or `UTF-16`.            |
| **Right pad fields**                   | Pads string fields with spaces (or truncates) until the field length in the **Fields** tab is reached.        |
| **Fast data dump (no formatting)**     | Improves performance for large outputs by skipping formatting.                                                |
| **Split every ... rows**               | Splits output into multiple files after N rows when N > 0.                                                    |
| **Add ending line of file**            | Adds an alternate ending row to the output file.                                                              |

#### Fields tab

Use the **Fields** tab to define output field formatting.

| Column/option     | Description                                                                                                                                                |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name**          | Output field name.                                                                                                                                         |
| **Type**          | Output data type.                                                                                                                                          |
| **Format**        | Optional conversion mask. See [Common Formats](https://docs.pentaho.com/pdia-data-integration/pdi-transformation-steps-reference-overview/common-formats). |
| **Length**        | Output length (varies by type).                                                                                                                            |
| **Precision**     | Number of floating-point digits for number-type fields.                                                                                                    |
| **Currency**      | Currency symbol (for example, `$` or `€`).                                                                                                                 |
| **Decimal**       | Decimal symbol (dot `.` or comma `,`).                                                                                                                     |
| **Group**         | Thousands separator (comma `,` or dot `.`).                                                                                                                |
| **Trim type**     | Trimming method to apply to strings. Trimming works only when no field length is specified.                                                                |
| **Null**          | String to write when the field value is null.                                                                                                              |
| **Get Fields**    | Populates the table from the incoming stream.                                                                                                              |
| **Minimal width** | Removes unnecessary padding. When selected, string fields are no longer padded to their specified length.                                                  |

For guidance on choosing data types and field metadata, see [Understanding PDI data types and field metadata](https://docs.pentaho.com/pdia-data-integration/understanding-pdi-data-types-and-field-metadata).

### See also

* [Text File Output (Legacy)](https://wiki.pentaho.com/pages/viewpage.action?pageId=7701492)


---

# 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.pentaho.com/pdia-data-integration/pdi-transformation-steps-reference-overview/text-file-output-cp.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.
