// converters

TSV to YAML.

Parse TSV (tab-separated values) and produce a YAML array of mappings using the first row as headers.

Client-sideTab-safeNo upload

TSV input

YAML output

TSV to YAML — tab-separated values.

TSV (Tab-Separated Values) is a flat format where tabs separate columns and newlines separate rows. This tool parses TSV data and converts it to a YAML array of mappings, using the first row as column headers. The conversion is identical to CSV-to-YAML but uses tab characters as the delimiter.

TSV is common in scientific data, database exports, and tools like R and pandas that use tab as the default delimiter. If your data was copied from a terminal or a tool that outputs tab-aligned text, TSV-to-YAML gives you structured, readable output.

When to convert TSV to YAML.

Database exports. Many database tools (pg_dump, mysqldump, sqlite3) export data as TSV by default. Convert the export to YAML for human-readable inspection, documentation, or use in configuration files.

Log analysis. Server logs often use tab-separated fields. Convert a log snippet to YAML to understand the structure, then use YAML tools (validators, sorters, diff) to analyze the data.

Data cleaning. YAML supports comments, anchors, and nested structures that TSV doesn't. Convert TSV to YAML when you need to add metadata, group related entries, or use YAML anchors to reduce repetition.

TSV vs CSV.

TSV is simpler to parse than CSV because tabs are rarely found in data values. CSV requires handling quoted fields, escaped delimiters, and multi-line values. TSV avoids most of these complexities. If your data contains commas, semicolons, or quotes, use TSV instead.

The trade-off is that TSV is less compact visually — tabs can create uneven alignment when viewed in a text editor. But for machine processing, TSV is more reliable.

TSV format fundamentals.

TSV (Tab-Separated Values) is one of the simplest data exchange formats. Each line is a record, and each record contains fields separated by tab characters. The first line typically contains column headers. Unlike CSV, TSV rarely requires field quoting because tab characters almost never appear in actual data values.

The simplicity of TSV makes it a preferred format for scientific computing, bioinformatics, and data science workflows. Tools like R, pandas, and MATLAB default to TSV for data import because the parsing rules are straightforward and unambiguous. This predictability reduces errors in data pipelines.

Conversion use cases.

Scientific data. Research datasets, CSV/TSV exports from lab equipment, and bioinformatics files (FASTQ, BED) often use TSV. Convert these to YAML for documentation, version control, or integration with configuration management tools.

Database administration. Tools like PostgreSQL's psql and MySQL's command-line client output query results as TSV by default. Convert the output to YAML for readable documentation or for use in automated deployment scripts.

Log processing. Server logs, application logs, and monitoring data frequently use tab-separated fields. Convert log snippets to YAML to structure the data, add metadata, or prepare it for analysis with YAML-aware processing tools.

Excel and Google Sheets workflow.

Both Excel and Google Sheets can import TSV data directly. In Excel, use Data → From Text and select tab as the delimiter. In Google Sheets, paste TSV data and it automatically splits into columns. After importing, you can clean, sort, and analyze the data before re-exporting if needed.

When copying TSV data from this tool to a spreadsheet, the tab characters are preserved, so the data will paste correctly into separate columns. This makes the tool useful for quick data transfers without saving intermediate files.

Tips for reliable conversion.

Ensure the first row of your TSV contains column headers — these become the YAML keys. All subsequent rows become array elements. If rows have inconsistent columns, the tool fills missing values with empty strings. Normalize your data before converting for the cleanest YAML output.

Watch out for trailing tabs at the end of lines, which some tools produce. These create extra empty columns in the output. Trim your TSV data before pasting it into the converter for the most predictable results.

FAQ

How do I convert a tab-separated file (TSV) to YAML?

TSV is just CSV with `\t` as delimiter — `miller --itsv --ojson file.tsv | yq -p=json -o=yaml` or Python `csv.DictReader(f, delimiter='\t')`.

Can I convert TSV to YAML with the first row as keys?

Yes — both `miller` and `csv.DictReader` use the first TSV row as field names (headers) automatically when converting to structured YAML.

How do I handle TSV files exported from Excel or Google Sheets?

Excel/Sheets export uses `\t` separator and often UTF-8 BOM — strip the BOM with `sed '1s/^\xEF\xBB\xBF//'` then convert with `csv` or `miller`.

How do I convert TSV with quotes/escaped tabs to YAML?

Standard TSV doesn't escape tabs inside fields; use Python `csv.DictReader(f, delimiter='\t', quoting=csv.QUOTE_ALL)` to handle quoted fields properly.

What is the difference between CSV-to-YAML and TSV-to-YAML?

Just the delimiter (comma vs tab); conversion logic is identical, you just specify `delimiter='\t'` instead of default `,`.