T tomlkit·org
Inspect Formatter Validator Lint Stats Keys Query Convert TOMLJSON JSONTOML TOMLYAML YAMLTOML INITOML TOMLINI .envTOML TOML.env TOMLTS TOMLCSV CSVTOML TOMLXML TOML.properties .propertiesTOML Transform Sort keys Flatten Unflatten Redact Minify Generate Go struct Rust struct Python types JSON Schema Compare Diff Merge

TOML to CSV

updated 20 August 2026

Two ways to get a TOML file into a spreadsheet: a flat key,value sheet with one row per setting, or a proper table with one row per [[entry]] and a column per field. Pick the layout, pick the delimiter, download the CSV.

RFC 4180 quoting

What this tool does

It converts a TOML document into comma-separated rows, in one of two shapes. Key / value flattens the whole document into dotted paths and writes a two-column sheet — every setting in the file, one per row, which is what you want for review or diffing in a spreadsheet. Table takes an array of tables and writes it as a real data table: a header row from the union of all keys, then one row per entry.

The intent it closes: "I need this config in a spreadsheet." Sometimes that is for a review meeting, sometimes to compare two environments side by side, sometimes because the list of servers or feature flags in the config is genuinely tabular data that lives in a config file.

Nested values are handled honestly. In table mode, sub-table fields become dotted column names, so a [[servers]] entry with tls.enabled gets a tls.enabled column. Arrays inside a cell are written as compact JSON, since CSV has no way to nest.

When you'd reach for it

  • Review a config with people who do not read TOML. A two-column sheet is a format everyone can open.
  • Compare environments. Export staging and production to CSV, paste both into one sheet, and let conditional formatting show the differences.
  • Pull tabular data out of a config. Lists of servers, routes, rate limits, or feature flags stored as [[arrays]] are already rows and columns.
  • Feed a bulk-edit workflow. Export, edit in a spreadsheet, then bring it back with CSV to TOML.
  • Get a count. Sometimes you just want to know how many keys a config has, and a spreadsheet answers that in one click.

How it works

The two layouts share a parser and diverge after it.

1. Parse the TOML

The document is parsed into a value tree, so dotted keys are already nested and [[array]] blocks are already arrays before any flattening happens. A parse error stops the run and the status bar reports it.

2. Choose rows

In Key / value mode the whole tree is flattened to dotted paths and each becomes a row. In Table mode the tool finds the array of tables to export — either the path you typed, or the first one it finds walking the document — and takes each entry as a row. Column headers are the union of every entry's keys, in first-seen order, so a field missing from one entry leaves an empty cell rather than shifting the row.

3. Write CSV

Values are stringified: dates as their TOML text form, booleans as true/false, arrays as JSON. Any cell containing the delimiter, a quote, or a newline is wrapped in double quotes with internal quotes doubled, per RFC 4180. Rows are joined with LF, or CRLF if you picked the Excel option.

Options reference

Layout

Key / value gives you the whole document as key,value rows, with dotted paths for nested keys — complete, but not tabular. Table gives you one array of tables as a proper sheet with a header row. If the document has no array of tables, table mode reports that instead of guessing.

Array path

Which array to export in table mode, as a dotted path such as servers or tool.deploy.targets. Leave it blank to auto-detect the first array of tables in the document — enough for the common case where there is only one.

Delimiter

Comma is the default and the safest for tooling. Semicolon is what Excel expects in locales that use a comma as the decimal separator. Tab avoids quoting almost entirely — if that is your preference, tsvkit.org is the sibling site for TSV work.

Line endings

LF for anything Unix-shaped, CRLF when the file is going straight into Excel on Windows. Both are valid CSV; only Excel is picky.

Example

Input, in Table layout:

[[servers]]
name = "alpha"
ip = "10.0.0.1"
region = "us-east"

[[servers]]
name = "beta"
ip = "10.0.0.2"

Output:

name,ip,region
alpha,10.0.0.1,us-east
beta,10.0.0.2,

The header is the union of both entries' keys. beta has no region, so its cell is empty rather than the row being short. The same input in Key / value layout would produce five rows: servers.0.name, servers.0.ip, servers.0.region, servers.1.name, servers.1.ip.

FAQ

Which layout should I pick?

If the thing you want in the spreadsheet is a list — servers, routes, flags stored as [[entries]] — pick Table. If you want the whole config for review or diffing, pick Key / value. Table mode needs an array of tables to exist; key/value mode always works.

What happens to nested tables inside an array entry?

Their fields become dotted column names: an entry with tls = { enabled = true } contributes a tls.enabled column. That keeps every value addressable without inventing extra header rows.

How are arrays written into a cell?

As compact JSON — ["a","b"]. CSV cannot nest, and JSON at least round-trips: CSV to TOML reads it back as a string you can convert, and any spreadsheet shows it readably.

Will Excel open the output correctly?

Yes, with two caveats worth knowing: pick the semicolon delimiter if your Excel locale uses commas for decimals, and pick CRLF line endings. Quoting is already RFC 4180-compliant.

Can I get back to TOML afterwards?

Yes — that is what CSV to TOML is for. It reads both shapes: a two-column key/value sheet (with optional re-nesting of dotted keys) and a full data table exported as an array of tables.