1. Home
  2. Spreadsheet & data tools
  3. CSV to SQL

CSV to SQL

Seed a test database, load a lookup table or move a spreadsheet into SQL: get a ready-to-run script with sensible column types instead of writing INSERT statements by hand.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use CSV to SQL

  1. Drop the CSV or Excel file.
  2. Pick the database, table name and options.
  3. Copy the SQL or download the .sql file.

Features

  • MySQL/MariaDB, PostgreSQL, SQLite and SQL Server
  • Column types inferred: INT, BIGINT, DECIMAL, DATE, DATETIME, BOOLEAN, VARCHAR
  • Leading-zero codes kept as text
  • Batched multi-row INSERTs, optional transaction
  • Quotes and backslashes escaped per database

Supported formats

You can open

  • CSV
  • TSV
  • TXT
  • XLSX
  • Pasted data

You get

  • SQL
  • Copied text

Private by design

Your files are opened and processed by your browser on this device. They are never uploaded to openWorkstand or anyone else, so the CSV to SQL is safe for contracts, IDs, photos and work documents. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Review generated SQL and run it in a test database first; column types are inferred from the data and may need adjusting.

Guide

Generating CREATE TABLE and INSERT statements from a CSV

Moving a spreadsheet into a database usually means writing a CREATE TABLE statement, guessing column types and then thousands of INSERT lines with careful quoting. This tool does all of it from a CSV or Excel file, for MySQL, PostgreSQL, SQLite or SQL Server, and shows you the inferred types before you run anything.

Choosing the database

Each database quotes names and escapes text differently. MySQL uses backticks and treats backslashes as escape characters, so they are doubled. PostgreSQL and SQLite use double quotes around names. SQL Server uses square brackets and writes text as N’…’ so Unicode characters survive. Pick the database and the script follows its rules.

How types are inferred

Each column gets the narrowest type that fits every non-empty value. Whole numbers become INT, or BIGINT beyond about two billion. Decimals become DECIMAL or NUMERIC with exactly the precision and scale the data needs, such as NUMERIC(7,2) for prices. ISO dates become DATE, date-times DATETIME, TIMESTAMP or DATETIME2, and true/false values BOOLEAN or the database’s equivalent. Everything else is VARCHAR sized with some headroom, or TEXT for long values. The column table shows every decision before you copy the script.

Leading zeros and IDs

Values with leading zeros, like 007 or 02134, keep the column as text, because a numeric type would silently drop the zero. Numbers written with thousands separators, such as 1,200.50, also stay text; clean them first if you want a numeric column.

NULL and empty cells

With “Empty cells as NULL”, empty cells become NULL, which databases treat as missing. Switch it off to insert empty strings into text columns instead. Numeric and date columns always use NULL for empty cells, since an empty string is not a valid number or date.

Names

“snake_case column names” turns headers like “Order ID” or “Prénom Client” into order_id and prenom_client, which are easy to type in queries. Switch it off to keep the original names, which are then quoted. Duplicate names get a numeric suffix. Table names may include a schema, written as schema.table.

Batching and transactions

Rows are grouped into multi-row INSERT statements, 100 per statement by default, which loads much faster than one statement per row. SQL Server accepts at most 1,000 rows per statement. Wrapping the script in a transaction means either all rows are inserted or none, if something fails halfway. DROP TABLE IF EXISTS replaces an earlier test table.

Review before running

Generated SQL is code. Check the table name, the types and a few INSERT lines, and run it in a development or test database first, especially when real data matters.

SQLite and its flexible types

SQLite stores dates as text and decimals as REAL, and accepts any value in any column. The script therefore uses TEXT for dates and REAL for decimals there. If you need exact money values in SQLite, store amounts as integers in cents in your application.

Tidy queries with the SQL Formatter. Create realistic test data with the Mock Data Generator, which can write SQL directly. To check what a CSV contains before loading it, use the CSV Data Profiler.

Checked against the current version of the CSV to SQL on .

Troubleshooting

The file does not open

Check that it is one of the supported formats above and opens in another app. Damaged files and password-protected PDFs cannot be read until they are repaired or unlocked.

It is slow or stops on a very large file

Everything runs on your device, so speed depends on its memory. Close other tabs, use a computer rather than a phone, or split the file into smaller parts first.

The download did not start

Look for your browser’s download bar or icon. Some browsers ask once before a site may download files; allow it and click the button again.

Frequently asked questions

Why is my ZIP code column VARCHAR instead of INT?

Because at least one value starts with a zero, such as 02134. Storing it as a number would turn it into 2134. Codes, IDs and phone numbers are identifiers, not quantities, so text is the right type.

How do I load a very large CSV?

For hundreds of thousands of rows, the database’s own bulk loader is faster: LOAD DATA INFILE in MySQL, COPY in PostgreSQL, .import in SQLite or BULK INSERT in SQL Server. This tool suits small and medium tables, seed data and test fixtures.

How are column types chosen?

From the values: whole numbers become INT or BIGINT, decimals DECIMAL with the right precision, ISO dates DATE or DATETIME, true/false BOOLEAN, and everything else VARCHAR or TEXT. Codes with leading zeros, such as ZIP codes, stay text.

Can I run the script on a production database?

Review it first and run it in a test database. Generated SQL is code; check table names, types and NULL handling before running it where data matters.

Keep working with the result

After you download, choose “Save to Workstand” to keep the result in a folder on your computer, attach it to a project and create a follow-up task. It is saved by your browser, not uploaded.