Browser-local TSV utility

Merge TSV files without uploading them

Choose two or more TSV files, then require identical ordered headers or build a predictable first-seen union.

  1. Choose header handling, then select or drop your TSV files.
  2. Inspect the combined rows and columns in the editor.
  3. Use Download a copy for the complete merged TSV, or More document tools → TSV for the filtered view.

Files of 8 MiB or larger open in a paged TSV editor. Active-view TSV, CSV and JSON downloads are available for files under 8 MiB.

Merge options

Strict requires matching headers. Ordered union includes each encountered column.

Strict mode

Use strict mode for monthly exports from the same system. It stops before output when any header or column order differs.

Ordered union

Union mode keeps the first file’s columns, appends new columns as they appear, and fills missing fields with empty text.

Work with TSV using code

For repeat jobs, use Python or SQL on your computer. Choose an example below for setup, code and output details.

Merge TSV files with Python

Writes merged.tsv with one header, then every data record from input.tsv followed by second.tsv.

View code and setup

Before you start

  • Install Python 3; csv and json are included, so no package installation is needed.
  • Put input.tsv in your working folder. These examples read UTF-8 spreadsheet-quoted TSV with a header. For merge, add second.tsv; for editing, use columns named id and note.
  1. Save the Python code as tsv_task.py, then run python3 tsv_task.py from that folder. On Windows, use py tsv_task.py.
  2. Inspect the separate output before replacing any source file.
Python TSV task
import csv

paths = ["input.tsv", "second.tsv"]
columns = None
all_rows = []
for path in paths:
    with open(path, encoding="utf-8-sig", newline="") as source:
        reader = csv.reader(source, delimiter="\t", strict=True)
        header = next(reader)
        if columns is None:
            columns = header
        elif header != columns:
            raise ValueError("Headers must match in name and order")
        for row in reader:
            if len(row) != len(columns):
                raise ValueError("Each record must match the header width")
            all_rows.append(row)
with open("merged.tsv", "w", encoding="utf-8", newline="") as result:
    writer = csv.writer(result, delimiter="\t")
    writer.writerow(columns)
    writer.writerows(all_rows)

Limits and output

  • Values remain strings, including leading zeroes, empty fields and text such as NULL. This does not infer numeric or date types.
  • Quoted tabs and newlines are supported. For plain TSV where quotes are literal, add quoting=csv.QUOTE_NONE to the reader; plain output cannot represent tabs or newlines inside fields without an agreed escaping rule.
  • The example holds records in memory and rewrites quoting and line endings; it is not a byte-preserving copy. It does not prefix spreadsheet formulas: import sensitive columns as text and review formula-looking values before opening a spreadsheet.

Documentation: Python csv reader, writer and dialects

Merge TSV files with DuckDB

Append files by header name using a column union. This is different from the Python example's strict identical-header check.

View code and setup

Before you start

  • Install the DuckDB command-line client using its official installation instructions. On macOS with Homebrew, run brew install duckdb.
  • These SQL examples assume input.tsv has exactly the columns id and note. Adjust force_not_null and the editing expressions for your actual columns; add second.tsv for merging.
  1. Run duckdb in the folder containing the files, paste this SQL, then enter .quit when finished.
DuckDB SQL
COPY (
  SELECT * FROM read_csv(['input.tsv', 'second.tsv'],
    delim='\t', header=true, all_varchar=true,
    force_not_null=['id','note'], union_by_name=true)
) TO 'merged.tsv' (FORMAT CSV, DELIMITER '\t', HEADER true);

Limits and output

  • all_varchar keeps columns as text; force_not_null keeps empty id and note fields as empty strings rather than SQL NULL. DuckDB may normalize blank or duplicate column names, so use Python's columns/rows JSON shape when exact headers matter.
  • This reads spreadsheet-quoted TSV, not ClickHouse-style backslash-escaped TSV. SQL exports retain literal formula-looking strings; spreadsheet applications may interpret them when opened.
  • union_by_name fills absent columns with SQL NULL; review the resulting columns. This appends records and does not join matching IDs. SQL row order is not guaranteed without an explicit ORDER BY; use the Python method to retain file and record order.

Documentation: DuckDB installation; DuckDB CSV options; DuckDB COPY exports

Merge TSV files with ClickHouse

Create a separate output using ClickHouse locally. These SQL copies are sorted by id and note, rather than preserving physical source order.

View code and setup

Before you start

  • Install the ClickHouse binary for your platform using the official installation instructions. The command below is for a Unix-style shell.
  • Use a UTF-8 input.tsv with exactly the unique header names id and note. Add second.tsv with the same columns for merging; adjust the declared String schema for other files.
  1. Run the command from the folder containing your TSV. Choose an output name that does not already exist; ClickHouse refuses to overwrite an existing output file.
ClickHouse local command
clickhouse local --path ./tsv-local-work --max_threads 2 --multiquery <<'SQL'
SET format_csv_delimiter = '\t';
SET input_format_csv_allow_whitespace_or_tab_as_delimiter = 1;
CREATE TEMPORARY TABLE data AS SELECT * FROM file('input.tsv', 'CSVWithNames', 'id String, note String');
INSERT INTO data SELECT * FROM file('second.tsv', 'CSVWithNames', 'id String, note String');
SELECT * FROM data ORDER BY id, note
INTO OUTFILE 'merged.tsv' FORMAT CSVWithNames;
SQL

Limits and output

  • The CSVWithNames reader is explicitly configured with a tab delimiter and quoted-field support. ClickHouse's native TabSeparated format instead uses backslash escaping and is not interchangeable with spreadsheet-quoted TSV.
  • The declared String columns preserve leading zeroes and empty text for this schema. ClickHouse CSV rules can trim unquoted spaces; inspect whitespace-sensitive data. This is not a byte-preserving export and does not prefix formula-looking text for spreadsheet use.
  • Both files must fit the declared schema. This appends records and sorts the result; it does not join matching IDs or offer an ordered column union.

Documentation: ClickHouse installation; ClickHouse local; ClickHouse CSVWithNames

TSV questions and answers

How are TSV files merged?

Choose 2 to 20 files, up to 50 MiB combined. Strict mode requires identical ordered headers. Ordered union keeps first-seen columns and fills missing fields with empty text. Files are appended in order, not joined by a key.

How do plain and spreadsheet-quoted TSV differ?

Plain TSV treats quotes as text: tabs separate fields, and CR or LF end records. Spreadsheet-quoted TSV permits tabs and line breaks inside quoted fields and doubles literal quotes. Explicit rules keep raw first-record headers, correctly shaped empty records and string values. Every record must match the header width. Existing compatibility remains the default.

Can I change TSV rules after opening a file?

Open More document tools, expand TSV interpretation and choose different rules. The editor prepares and validates the accepted original file before replacing the document. Cancel keeps the current rules, edits and Undo history. A plain TSV field cannot contain a tab or line break; use Export spreadsheet-quoted copy to keep those values in a separate file.

Can I review the rules without losing selected files?

Yes. Explicit rules show a bounded preview before opening, merging or converting. Keep inputs for later retains the selection; choose different rules and review again. The preview covers at most 10 data records, 12 columns and 160 characters per value; the complete operation still validates the entire source.

Can I check TSV values with reusable column rules?

Open Validation in the editor, or expand Validate complete table inside the paged editor's Selection and replace tools. Check required values, literal types and exact allowed values across every edited source row, including filtered-out rows. Complete validation supports 100,000 data records, 2,000 columns, 2 million cells and column-rule checks, 64 MiB of table text and 1 MiB of encoded rules. Portable JSON settings require exactly matching header names and positions, followed by manual Use. The preview shows up to 1,000 issues; a separate CSV report includes every issue within 64 MiB. Checks run in a cancellable local worker with a 10-second deadline. Values and source-save state stay unchanged; original-file quoting is a separate check.

How can I read long or multiline TSV cells?

In Views, or Selection and replace for a paged source, open Cell text and choose Wrap text in taller rows. Row heights stay fixed so columns remain aligned; wrapping changes presentation only and preserves literal values, scroll, selection and Undo history. Selected-cell tools expose the complete value. The wrap preference stays local and is not included in version 1 portable projects.

Can I inspect the records behind a grouped or pivot summary?

In Analysis, select a summary value to inspect every contributing record in original source order, including rows hidden by filters. Page through the complete bounded result and read full values separately from abbreviated cells. A separate source-record report uses canonical UTF-8 text and is limited to 64 MiB. Loaded-table inspection supports up to 100,000 rows; paged complete scans may refuse when resource budgets cannot fit. Numeric conversion is explicit: loaded-table summaries use floating-point arithmetic, while paged summaries use exact decimal arithmetic. Reports do not save or modify the source.

What are the TSV file and export limits?

Ordinary viewing accepts one file up to 5 GiB, subject to browser capacity. Files of 8 MiB or larger use a paged editor. Batch CSV and JSON conversion accepts files up to 1 GiB, subject to available browser storage, with cells under 1 million characters, records under 4 million characters and up to 4,096 columns. Without browser file storage, results are limited to 32 MiB. Active-view editor exports require files under 8 MiB. Merge accepts 2 to 20 files with a 50 MiB combined limit.

Does my TSV file leave my browser?

Selection, parsing, editing, merging and conversion run locally without signup or file-content upload. Download a copy to keep your work. Reload restores the accepted original input and explicit input rules when browser entry storage is available; it does not save unsaved cell edits. Large inputs must be reopened. The paged editor offers its own revision-bound recovery journal; saved projects keep their explicit interpretation separate from source access.