Converting TSV spreadsheet data into a TOML config file by hand is a headache.
One wrong bracket and the whole file breaks. You forget a quote. The parser fails. You spend twenty minutes hunting for a missing ].
Let's look at why TOML is useful and how to convert your tabular data into it safely.
Why TOML?
TOML (Tom's Obvious, Minimal Language) is a configuration file format designed to be easy to read and write. It's heavily used in modern development:
- Rust:
Cargo.toml - Python:
pyproject.toml - Hugo: Site configuration
- Netlify:
netlify.toml
Unlike JSON, TOML supports comments and is much easier for humans to read and edit manually.
The TSV to TOML Problem
TSV (Tab-Separated Values) is flat. It's just rows and columns. TOML is hierarchical. It has sections (tables) and key-value pairs.
If your TSV looks like this:
name version description my-app 1.0.0 A cool tool You need to convert it to this:
[package] name = "my-app" version = "1.0.0" description = "A cool tool" Doing this manually means carefully typing brackets, adding quotes around strings, and ensuring the data types are correct. If you have 100 rows, it's a nightmare.
The Code Way (JavaScript)
If you're writing a script, you can parse the TSV and build a TOML string.
function tsvToToml(tsvString) { const lines = tsvString.trim().split('\n'); const headers = lines[0].split('\t'); const values = lines[1].split('\t'); let toml = '[config]\n'; headers.forEach((header, index) => { // Add quotes around string values toml += `${header} = "${values[index]}"\n`; }); return toml; } This handles basic key-value pairs. But if your TSV represents nested data (e.g., multiple [tables]), the logic gets much more complex.
Common Gotchas
- Data Types: TOML is strict about types. Strings need quotes (
"value"), integers don't (123), and booleans are lowercase (true). - Special Characters: If your TSV data contains double quotes, you have to escape them in TOML (
\"). - Nested Tables: TOML uses
[table.subtable]syntax. Flat TSV data doesn't easily map to this without custom logic.
The Visual Way
If you just need to convert a spreadsheet into a TOML config file without writing a custom script, I built a free TSV to TOML Converter.
What it does:
- Converts TSV data into structured TOML
- Handles nested configurations automatically
- Outputs clean, human-readable format
Why it's useful:
- No installation
- No upload (100% client-side)
- Saves you from typing brackets and quotes
- Fast
Try It
100% client-side. Nothing uploaded.
What's your preferred configuration format? Do you use TOML, YAML, or JSON? Let me know in the comments.