DevSwitch.net
Back to Tools
⇄

YAML to CSV Converter

Convert YAML data to CSV format

File Converters

Tip: Paste your YAML data. If it's an array of objects, the keys will be used as CSV headers.

Runs in your browser

Input YAML

Convert YAML to CSV in your browser

Paste YAML, open a .yaml or .yml file or drop it on the input window, and the CSV appears as you type. Each item of a list becomes a row, and the keys become the header. Copy the table or download it as a .csv file for a spreadsheet.

The header holds every key found in any item, in the order the converter first meets it. An item without one of those keys gets an empty cell, so every row has the same columns.

YAML to CSV example

Real output for a config with two services. The ports list and the env mapping are spread over columns, and the cells a service does not have stay empty:

services.yaml
- name: api
  image: nginx:1.27
  ports:
    - 8080
    - 8443
  env:
    LOG_LEVEL: info
- name: worker
  image: node:22
  replicas: 3
  env:
    LOG_LEVEL: debug
services.csv
name,image,ports.0,ports.1,env.LOG_LEVEL,replicas
api,nginx:1.27,8080,8443,info,
worker,node:22,,,debug,3

Which YAML shapes give rows

A CSV is one flat table, so the converter first decides what a row is:

  • YAML

    - name: api
    - name: worker

    CSV

    A list of mappings: each item is a row. This is the shape that converts best.

  • YAML

    services:
      - name: api

    CSV

    A list under the only top-level key: the list items are the rows, and the key itself is not a column.

  • YAML

    name: api
    image: nginx:1.27

    CSV

    A single mapping: one row, with a column per key.

  • YAML

    - 8080
    - 8443

    CSV

    A list of plain values: one column named value.

Nested keys and lists as columns

Inside a row, nested values are flattened into columns named by their path:

In the YAMLIn the CSV
env: {LOG_LEVEL: info} Column env.LOG_LEVEL
ports: [8080, 8443] Columns ports.0 and ports.1
replicas: ~ An empty cell
active: true The text true
city: "Portland, OR" "Portland, OR", in quotes because of the comma

A value with a double quote or a line break, such as a multi-line | block, is also put in quotes, with inner quotes doubled, so a spreadsheet reads it as one cell.

Need YAML from a spreadsheet?

The CSV to YAML converter turns each row into a list item, with the header names as keys.

YAML to CSV questions

Click Open file and choose the .yaml or .yml file, or drop it on the input window. The table is built straight away; Download saves it as a .csv file.

The top level is a mapping with several keys, so there is no list to split into rows. Paste only the list you want as the table, or move it under a single top-level key.

No. A file with more than one document separated by --- shows an error. Convert one document at a time.

No. A CSV column named env.LOG_LEVEL becomes a flat key with that name, not a nested env mapping.

No. Converting runs in your browser, and an opened file is read there too.