About YAML to CSV
YAML is comfortable for people who live in text editors and awkward for everyone else. When a teammate wants to review an inventory, a list of test cases or a set of users in a spreadsheet, a table is a better form than an indented file.
Paste the YAML and each list item becomes a row. Nested fields become dotted columns, so location.city sorts and filters like any other column.
The result is a CSV to download or paste into a sheet. A table preview shows the shape first, which is useful when items have different fields.
How it works
The YAML is fully parsed first, so comments disappear, block text resolves and anchors and merge keys are applied before any row exists. If the top level is a mapping with exactly one list of mappings, such as team:, that list becomes the rows and a notice says so.
Each item is flattened: nested mappings turn into dotted column names, and a list inside an item stays in one cell as JSON text, since items can have different lengths. Columns are gathered from every item in order of first appearance.
A plain list of values becomes a single value column. A lone scalar has no rows to offer, so it gets an error instead of a one-cell file.
How to use YAML to CSV
- Paste your YAML, or use Open file to load a
.yamlor.yml. - If there is a parsing problem, fix it at the line and column given.
- Review the Table preview to see which rows and columns you got.
- Set the delimiter under Options if needed, then use Copy or Download .csv.
A team list under a top-level key
team:
- name: Ada Lovelace
location: {city: London}
skills: [maths, notes]
- name: Grace Hopper
role: "Rear Admiral, retired"
location: {city: Arlington}name,location.city,skills,role
Ada Lovelace,London,"[""maths"",""notes""]",
Grace Hopper,Arlington,,"Rear Admiral, retired"The team wrapper was unwrapped with a notice. location.city became a column, skills stayed as JSON in one cell, and role is empty for Ada because her entry has none.
When it helps
- Handing an Ansible inventory to someone who wants to check it in a spreadsheet.
- Reviewing a long list of test cases or fixtures by sorting on a column.
- Auditing a list of users or permissions stored in a YAML file.
- Comparing service definitions by laying them out side by side as rows.
Tips for a better result
- If your file has several lists at the top level, paste only the one you want. Otherwise the whole mapping becomes a single row and you are told why.
- Files with several
---documents become one row per document, which suits a folder's worth of similar manifests pasted together. - Add the byte order mark from Options if non-English text looks wrong when the file opens in Excel.
Good to know
- A list inside an item is never split into extra rows.
- Comments are lost, because they are not part of the data once parsed.
- Numbers and booleans are written with their parsed spelling, so
1.50in YAML appears as1.5in the cell. - Complex keys and custom tag meanings are not supported. See the YAML to JSON page for how those are treated.
Questions people ask
My file is one big mapping, not a list. What will I get?
One row, with a column for every nested key. To get a row per entry from a mapping of named items, such as services:, you need to rewrite it as a list first, as the names are keys and not values.
How does it pick which list becomes the rows?
It looks at the top level. Exactly one list of mappings gets used and the other fields are reported as left out. With two or more lists, nothing is unwrapped and you are asked to paste the list you want.
What happens with anchors and merge keys?
They are resolved before the table is built, so each row shows the values it would really have.
Can I use a semicolon or a tab?
Yes. Delimiter in the output is under Options. A semicolon suits Excel in locales where the comma is the decimal mark.
What to use next
- CSV to YAML: to turn the edited sheet back into YAML
- YAML to JSON: to see the whole structure, not only the rows
- YAML Validator: if the file does not parse and you want a focused check
Last reviewed . Read our editorial policy.