Skip to content

Convert ECSV to CSV

Convert Astropy ECSV tables to widely compatible CSV while checking lost metadata and data types.

Make CSV files online

We can't read ECSV files yet, so this conversion isn't available. If you can export your work to one of these formats - or others - we'll turn it into CSV:

Want to convert ECSV to CSV?

Let us know. We pick the conversions to add next by how many people ask for them.

How to convert ecsv to csv file

Scientific software often produces ECSV, while spreadsheet, database, and reporting applications commonly require ordinary CSV. Converting it makes the table easier to share and edit, but removes metadata that CSV cannot store.

What ECSV is

ECSV means Enhanced Character-Separated Values. It is a text-table format developed for the Astropy ecosystem and used mainly in astronomy and other scientific data workflows.

An ECSV file combines a YAML-style metadata header with delimited table data. The header can define column names, data types, units, descriptions, null handling, and other Astropy table metadata. A typical file begins with # %ECSV 1.0. ECSV can use commas, tabs, or another delimiter, so the file extension alone does not determine the separator.

Astropy writes this format from astropy.table.Table objects with format='ascii.ecsv'. Microsoft Excel and most general spreadsheet applications do not natively interpret the ECSV header as a table.

What CSV is

CSV stores one record per line, with fields separated by commas. A field containing a comma, quotation mark, or line break is normally enclosed in double quotation marks, and an embedded quotation mark is represented by two quotation marks.

CSV is supported by LibreOffice Calc, Microsoft Excel, database importers, programming libraries, and many web services. It is simpler and often smaller than ECSV, but it does not normally preserve units, descriptions, Astropy-specific data types, masks, provenance, or custom table metadata. CSV has common conventions rather than one completely uniform implementation, so applications can disagree about encoding, line endings, delimiters, and missing values.

Convert with Astropy

Astropy is the safest option because it reads the ECSV schema instead of treating the metadata header as ordinary data.

Install Astropy:

python -m pip install astropy

Run this command from the directory containing the source file:

python -c "from astropy.table import Table; Table.read('input.ecsv', format='ascii.ecsv').write('output.csv', format='ascii.csv', overwrite=True)"

This reads input.ecsv and writes a comma-delimited output.csv. The overwrite=True option replaces an existing output file; omit it if accidental replacement should be prevented.

For repeated conversions, save the following as convert_ecsv.py:

from astropy.table import Table

table = Table.read('input.ecsv', format='ascii.ecsv')
table.write('output.csv', format='ascii.csv', overwrite=True)

Run it with:

python convert_ecsv.py

If the source uses an unusual ECSV feature or contains masked values, inspect the resulting table and adjust the Astropy table before writing. Do not remove comment lines manually unless the file is a simple, known layout; doing so can lose column definitions or leave the data misaligned.

Use desktop and online tools

Use LibreOffice Calc or Microsoft Excel to inspect the generated CSV, not to parse the original ECSV. Open the result through File → Open, select comma as the delimiter when prompted, and check the detected types. When saving again, choose CSV and confirm comma as the delimiter and UTF-8 as the encoding where the application offers those settings. Locale-specific spreadsheet settings may otherwise produce semicolon-separated output or alter decimal and date values.

There is no broadly supported, ECSV-specific web converter that reliably preserves Astropy schemas. For a browser-based conversion, Google Colab is a practical online option: create a notebook, run !pip install astropy, upload the ECSV file, and execute the same Table.read(...).write(...) code. Do not upload confidential or regulated data to Colab or a third-party converter. Generic CSV websites such as Zamzar or Convertio should be used only if their current format list explicitly accepts ECSV; otherwise they may copy the YAML header into the output or interpret it as data.

Check the converted file

Compare the input and output column counts and row counts, then inspect the header, delimiter, character encoding, missing-value representation, and decimal separator. Open the CSV with a CSV-aware program because splitting lines manually breaks fields that contain quoted commas or line breaks.

The conversion cannot carry ECSV metadata into a normal CSV file. Preserve the original ECSV and record units, descriptions, provenance, and data types separately if they are needed for scientific interpretation.

Scalar numeric, text, and date-like columns usually convert directly. Multidimensional columns, quantities, masked columns, complex values, and custom Astropy objects may not have one portable CSV representation. Flatten or serialize those columns explicitly and verify the resulting values before importing the CSV into another application.

ECSV vs CSV: format comparison

How the ECSV and CSV formats compare on the properties that matter most for this conversion.

Comparison of the ECSV and CSV file formats
Property .ECSV Enhanced Character Separated Values .CSV Comma-Separated Values
Open standard Yes Yes
Compression Uncompressed Uncompressed
Typical file size Small Small
Opens in a web browser Yes, natively Yes, natively
Further editing Easy Easy
Metadata support Extensive Basic
Plain-text readable Yes Yes
Best used for Data exchange Data exchange
Introduced 2018 —
Developer Astronomical Data Center / Astropy community —
MIME type text/csv text/csv

Information about file extensions and file types is provided by File-Extensions.org

Already downloaded

This file has already been downloaded. For your privacy it was deleted from our server right after the download, so it cannot be downloaded again. To get it once more, convert the file again.