1001Ferramentas
📊 Converters

CSV to YAML List Converter

Convert a CSV with a header into a YAML list of objects, preserving numbers and booleans. Useful for building config files and fixtures from spreadsheets.

CSV to a YAML list

Turning a spreadsheet into a YAML list is what you do to populate a configuration file, feed an Ansible inventory or build sample data for a test. The manual route is typing key and value line by line with the right indentation, and the chance of a mistake grows with the number of columns.

Paste the CSV with headers on the first line and receive a list where each record becomes an item, using the column names as keys. Values gain types by shape: numbers stay unquoted, the booleans true and false stay unquoted, and everything else comes out quoted with internal quotes escaped — which avoids YAML's classic trap of a string being reinterpreted as another type.

The CSV reader here is a simple one: it splits on the comma without handling quotes. That means a quoted field containing a comma will be broken into two columns. For spreadsheets with addresses, descriptions or decimal values using commas, convert first to a separator that does not appear in the content — the CSV to PSV page handles that step.

Frequently asked questions

Why do strings come out quoted?
Because YAML interprets unquoted values: "yes" and "no" become booleans in YAML 1.1, "null" becomes nil, and "1.10" becomes the number 1.1, losing the trailing zero. Quoting everything that is not clearly a number or boolean is the conservative choice and avoids that class of surprise.
Can it produce a map instead of a list?
Not here: the output is always a list of items, which is the usual shape when each spreadsheet row is a record. For a keyed map, use one of the columns as the key and reindent the result — the generated structure is already set up to take that adjustment.
Does the indentation come out right?
It does: each item starts with a hyphen and the following keys align with the first field, which is what YAML requires. Take care when pasting into an existing file — if the block goes inside another key, you need to add the destination level's indentation to every line.

Related Tools