> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TSV

> Read tab-separated files with headers and publish a TSV dataset.

How-to guide

The TSV connector uses a tab as its default field separator. It reads files with or without headers and writes datasets with append or whole-dataset overwrite.

## Before you start

Prepare file access and a client connection using [Read and write files](https://docs.e6data.com/transformation/connectors/files.md). Prepare two columns named `order_id` and `amount`, with data rows `(1, 12.5)` and `(2, 7.5)`. Put an actual tab between fields in each record.

## Read data with headers

Enable headers explicitly. The default is `false`. With `header 'true'`, the first record supplies column names and is excluded from the data.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
CREATE OR REPLACE TEMP VIEW tsv_orders (
  order_id BIGINT,
  amount DOUBLE
)
USING tsv
OPTIONS (
  path '<input-tsv-file-or-folder>',
  header 'true',
  pathGlobFilter '*.tsv'
);

SELECT order_id, amount FROM tsv_orders ORDER BY order_id;
```

Expect two rows: `(1, 12.5)` and `(2, 7.5)`. The header must match the explicit schema in both names and order. Omit the column list and set `inferSchema 'true'` to infer types from a bounded sample instead.

## Read data without headers

Supply column names and types, and leave headers disabled:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
CREATE OR REPLACE TEMP VIEW tsv_orders_no_header (
  order_id BIGINT,
  amount DOUBLE
)
USING tsv
OPTIONS (path '<headerless-tsv-file>', header 'false');

SELECT * FROM tsv_orders_no_header ORDER BY order_id;
```

## Write data

Use the shared guide's `spark` connection and a private mounted output directory.

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
output_path = "<mounted-tsv-output-directory>"
orders = spark.createDataFrame(
    [(1, 12.5), (2, 7.5)], "order_id BIGINT, amount DOUBLE"
)

orders.write.format("tsv").mode("overwrite").option("header", "true").save(output_path)

written = (
    spark.read.format("tsv")
    .schema("order_id BIGINT, amount DOUBLE")
    .option("header", "true")
    .load(output_path)
)
written.orderBy("order_id").show()
assert written.count() == 2
```

Each part file has its own header when `header` is enabled. Use `mode("append")` to add rows with the same schema and compatible parsing settings.

## Options

| Option | Default | Read or write | Meaning |
| - | - | - | - |
| `header` | `false` | Both | Read or write a header record. |
| `delimiter` or `sep` | Tab | Both | Override the separator with one single-byte character. |
| `quote` | Double quote | Both | Choose one single-byte quote character. |
| `escape` | Backslash | Read; fixed for writes | Set read escaping. Writers keep the default and double embedded quotes. |
| `nullValue` | Unset | Both | Set a text marker for null fields. |
| `inferSchema` | `false` | Read | Infer types when the schema is omitted. |
| `compression` | `none` | Both | Read uncompressed or Zstandard input. Writes are uncompressed. |
| `mode` | `FAILFAST` | Read | Invalid input fails the read. Other parsing modes are rejected. |
| `encoding` | UTF-8 | Both | Only UTF-8 is accepted. |

Use the [shared file options](https://docs.e6data.com/transformation/connectors/files.md#read-options-shared-by-file-formats) for folder filtering and storage access. No delimiter option is needed for normal TSV input.

## Data types and limits

An explicit schema converts text fields to the selected types. Without a schema or type inference, discovered columns are strings. Keep header names, order, and field types consistent across a folder.

Quoted newlines are supported directly. `multiLine` is not a TSV option. Row updates, deletes, and merges are not supported by the file sink. Use a table connector when rows need those changes.

## Related guides

* [Read and write files](https://docs.e6data.com/transformation/connectors/files.md)
* [TSV with an explicit schema](https://docs.e6data.com/transformation/recipes/files/tsv-schema.md)
* [CSV parsing options](https://docs.e6data.com/transformation/connectors/files/csv.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.