Loona Automation logoLoona Developer Tools
Home › Developer Tools › CSV to SQL Converter

CSV to SQL Converter - Import CSV Data Into Any Database

In short: the CSV to SQL Converter reads your CSV, infers a sensible type for each column (integer, decimal, boolean, date or text), sanitises table and column names, and emits a CREATE TABLE plus one INSERT per row in your chosen dialect.

Every database import starts as a CSV and a pile of hand-written INSERTs. Paste the CSV, pick MySQL, PostgreSQL or SQLite, and get import-ready SQL in one click.

Private by design: everything in this tool happens 100% in your browser with JavaScript. Your input is never uploaded to a server, never stored and never seen by us - close the tab and everything is gone.

How to use the CSV to SQL Converter

  1. Paste your CSV - the first row must be the column names.
  2. Type a table name and choose your SQL dialect.
  3. Leave CREATE TABLE ticked if you want the table definition too.
  4. Click Generate SQL, then copy it or download the .sql file.
  5. Run the SQL in your database client to import the data.

How it works

Column types are inferred by scanning every value in the column: whole numbers become integers, decimals become floating point, true/false become booleans, and ISO dates (YYYY-MM-DD, with an optional time) become date/timestamp columns. A column that mixes types falls back to the widest type, and a column of mixed numbers and text becomes TEXT so nothing is lost. Empty cells become NULL. Identifiers are sanitised - lowercased, spaces and punctuation replaced with underscores, a leading digit prefixed - and then quoted for the dialect: backticks for MySQL, double quotes for PostgreSQL and SQLite. String values are single-quoted with internal quotes doubled, the SQL-standard escape.

Worked example

The row Ali,30,true under name,age,active becomes INSERT INTO "my_table" ("name", "age", "active") VALUES ('Ali', 30, TRUE); in PostgreSQL dialect.

Frequently Asked Questions

Is this CSV to SQL converter free?

Yes - completely free, no sign-up, no cap.

How are column types chosen?

By scanning all values in each column. Integers, decimals, booleans and ISO dates are detected; mixed columns fall back to TEXT.

What happens to empty cells?

They become NULL in the INSERT statements.

Which dialects are supported?

MySQL (backtick quoting), PostgreSQL and SQLite (double-quote quoting), with dialect-appropriate type names.

Is my data uploaded?

No. Conversion happens entirely in your browser.

Related Developer Tools

Embed this tool on your website — free

Add this tool to your own website or blog — it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the tool to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.