Convert Database Exports to CSV

Convert tab-delimited database export files (from MySQL, PostgreSQL, or SQLite) to CSV for use in spreadsheets and data tools.

Common Formats

Detailed Explanation

Database Export Conversion

Database tools often export query results in tab-delimited format. MySQL's mysql client, PostgreSQL's psql, and SQLite's command-line tool all default to tab-separated output. Converting these to CSV makes the data more portable.

Example: MySQL Query Output (TSV)

id	name	email	created_at
1	Alice Johnson	alice@example.com	2024-01-15 09:30:00
2	Bob Smith	bob@example.com	2024-01-16 14:22:00
3	Carol Williams	carol@example.com	2024-01-17 11:45:00

Converted to CSV

id,name,email,created_at
1,Alice Johnson,alice@example.com,2024-01-15 09:30:00
2,Bob Smith,bob@example.com,2024-01-16 14:22:00
3,Carol Williams,carol@example.com,2024-01-17 11:45:00

Database-Specific Considerations

MySQL: The mysql client outputs TSV by default. Redirect to a file with mysql -e "SELECT ..." > output.tsv. NULL values appear as the literal string "NULL".

PostgreSQL: Use \copy command or COPY TO with a tab delimiter. NULL values are empty by default.

SQLite: Use .mode tabs to output TSV, or .mode csv for direct CSV output. The .separator command can set custom delimiters.

Handling Database NULL Values

Databases export NULL values differently:

  • MySQL: NULL (literal text)
  • PostgreSQL: empty string or \N
  • SQLite: empty string

The converter treats these as regular text values and does not attempt to interpret NULL semantics. If your target system needs specific NULL handling, post-process the converted file.

Large Query Results

For very large query results (millions of rows), consider using the database's native CSV export feature instead:

  • MySQL: SELECT ... INTO OUTFILE
  • PostgreSQL: COPY TO ... WITH CSV HEADER

For moderate datasets (up to a few hundred thousand rows), this browser-based converter works efficiently.

Use Case

Converting database query results exported as TSV from MySQL, PostgreSQL, or SQLite into CSV format for sharing with team members, importing into Google Sheets, or loading into business intelligence tools.

Try It — TSV \u2194 CSV Converter

Open full tool