Excel Tools

Excel to SQL

Turn a worksheet into SQL INSERT statements for MySQL, MariaDB, PostgreSQL, SQLite or SQL Server. Column types are detected from the data, an optional CREATE TABLE is generated, and values are escaped for the chosen database.

✓ Private · no uploads

SpreadsheetSQL statements

Runs locally in your browser

Options

No file selected yet.

Only the selected worksheet is exported, using its saved values. Fully empty rows are skipped.

How to use

  1. Choose or drop an Excel, OpenDocument or CSV file and pick the worksheet. The first row supplies column names.
  2. Select the database, edit the table name, and choose whether to include CREATE TABLE, multi-row INSERTs and NULL for empty cells.
  3. Copy the SQL or download it as a .sql file. The output updates instantly when you change an option.

Examples

Load a product sheet into PostgreSQL

Numbers stay numeric, the quote in O’Brien is doubled, booleans use PostgreSQL literals and Excel dates become ISO dates.

Input
id | name | price | active | added
1 | O'Brien Mug | 12.5 | TRUE | 2026-01-05
Output
CREATE TABLE "products" (
  "id" INTEGER,
  "name" TEXT,
  "price" NUMERIC,
  "active" BOOLEAN,
  "added" DATE
);

INSERT INTO "products" ("id", "name", "price", "active", "added") VALUES
  (1, 'O''Brien Mug', 12.5, TRUE, '2026-01-05');

From spreadsheet to database in seconds

Developers and analysts constantly receive data in Excel that needs to end up in a database: seed data, lookup tables, migration fixes or one-off imports. Writing INSERT statements by hand is slow and error-prone, especially with quotes, dates and empty cells. This generator produces clean, database-specific SQL that you can paste into a client such as psql, MySQL Workbench, DBeaver or SQL Server Management Studio.

Options

  • Database: MySQL / MariaDB uses backticks, PostgreSQL and SQLite use double quotes, and SQL Server uses square brackets and N’’ strings.
  • Table name: defaults to the worksheet name in lower case with underscores, and can be edited freely.
  • CREATE TABLE: adds a table definition with detected types — for example VARCHAR(n) sized to the longest value on MySQL, NVARCHAR on SQL Server, and TEXT on PostgreSQL and SQLite.
  • Multi-row INSERT: groups up to 500 rows per statement for fast imports; turn it off for one statement per row.
  • Empty cells as NULL: writes NULL for blank cells, or empty strings when turned off. Error cells such as #N/A always become NULL.

Header names are used as column names; empty headers become column_1, column_2 and so on, and duplicates get a numeric suffix. Without a header row, columns are named after their letters. Fully empty rows are skipped.

To tidy the result, paste it into the SQL Formatter. If an application needs JSON instead, use XLSX to JSON.

Frequently asked questions

Which databases are supported?

MySQL and MariaDB, PostgreSQL, SQLite and Microsoft SQL Server. Identifier quoting, string escaping, boolean literals and column types follow the selected database.

How are column types chosen?

From the actual cell values: whole numbers become INTEGER or BIGINT, other numbers a decimal type, TRUE/FALSE a boolean type, date-formatted cells DATE or a timestamp type, and everything else text. Numbers with leading zeros, such as ZIP codes, are kept as text.

Are values escaped safely?

Yes. Single quotes are doubled, MySQL backslashes are escaped, SQL Server strings use N'' Unicode literals, and identifiers are quoted with the database’s own syntax. Review generated SQL before running it on production data.

How are dates exported?

Cells with a date format become ISO 8601 text such as '2026-01-05' or '2026-01-05 14:30:00', which every supported database accepts. The time zone of your computer is never applied.

Can I convert a CSV file to SQL too?

Yes. CSV values are read as text so identifiers keep their leading zeros; numeric columns can be cast after import.

Is my data uploaded?

No. The SQL is generated in your browser.

Related tools