Convert CSV to SQL
Turn CSV files into SQL. SQL in SQLite's dialect that creates one table named data, its columns typed from the values, such as integers, decimals, dates and text, and inserts every row, as SQLite's .dump writes it inside one transaction, so MySQL and PostgreSQL do not run it as it is.
Converted in an isolated sandbox on our serversDeleted after 24 hours
Drop CSV files on the dialor turn it to pick what to do
A SQL script that builds a table from your CSV.One table named data, with every row inserted in one transaction.
What you get
A SQL script in SQLite's dialect. It creates one table named data and inserts every row of the CSV, written the way SQLite's .dump writes it, all inside one transaction.
The columns are typed from the values, such as integers, decimals, dates and text. A column that mixes numbers and text further down is kept as text.
What to expect
The script is SQLite's dialect, so MySQL and PostgreSQL do not run it as it is.
Decimals keep every digit SQLite stores, so 41.7 comes out as 41.700000000000002842.
Headers and delimiters
By default the first row holds the column names. Turn off Header row if the first row is data, and the columns are named column0, column1 and so on.
Delimiter is guessed from the rows when you leave it out. Set Delimiter to comma, semicolon, tab or pipe if the guess is wrong. Spreadsheets in many European locales use semicolons.
To go the other way, use SQL to CSV.
CSV and SQL.What each format is, and the options this conversion takes.
- 01 · delimiter
Delimiter
The character between fields. It is guessed from the rows when left out. Spreadsheets in many European locales use semicolons.
commaA comma.semicolonA semicolon.tabA tab.pipeA vertical bar.
- 02 · header
Header row
Whether the first row holds the column names rather than data.
default true
The formats
CSV
Rows of comma-separated values. The plainest way to move a table between programs.
- Extensions
- .csv
- MIME type
- text
/csv - Kind
- Text and data
SQL Script
SQL statements as text. A database dump that any SQL tool can read or replay.
- Extensions
- .sql
- MIME type
- application
/sql - Kind
- Text and data
In your code.The same CSV to SQL conversion through the API, for your app or your agent.
$ cv convert sheet.csv sheet.sql$ cv convert sheet.csv sheet.sqlQuestions.What people ask about CSV to SQL.
Not as it is. It is written in SQLite's dialect, so MySQL and PostgreSQL do not run it unchanged.
The table is named data. Every row of the CSV is inserted into it.
Decimals keep every digit SQLite stores. The longer number is what SQLite holds for 41.7.
Turn off Header row. The columns are then named column0, column1 and so on, and the first row is kept as data.