CSV to SQL

Convert CSV data into a ready-to-run CREATE TABLE and INSERT SQL statements.

About this tool

Turns CSV data into ready-to-run SQL — a CREATE TABLE statement with column types guessed from your data, followed by INSERT statements for every row — so you can load a spreadsheet export straight into a real database without hand-writing the schema.

How to use it

  1. Paste CSV data with a header row, and set the table name you want in the generated SQL.
  2. Click Generate SQL — the tool infers each column's type (INTEGER, REAL, BOOLEAN, or TEXT) by sampling its values.
  3. Copy the SQL or download it as a .sql file, then run it against your database.

FAQ

How does it decide column types?

Each column is sampled across all rows: if every value parses as a whole number it becomes INTEGER, if every value is numeric with a decimal it becomes REAL, if every value is exactly true/false it becomes BOOLEAN, and otherwise it defaults to TEXT.

Will the generated SQL run on any database?

The syntax targets standard SQL and works as-is on SQLite and Postgres in most cases; MySQL and other engines may need minor type-name adjustments (e.g. BOOLEAN handling varies by engine).

Is my CSV data uploaded anywhere to generate the SQL?

No — parsing and SQL generation both happen entirely in your browser.

Related tools

← All tools · Blog · FAQ