ExcelTool.io

Excel to SQL Converter

Generate SQL scripts from worksheet rows. Choose a dialect, review the output, then copy or download the script.

Drop your file here or click to upload

Supports .xlsx, .xls, .xlsm, .xlsb · up to 50MB · or paste a file from your clipboard

How to Convert Excel to SQL

  1. Upload an Excel workbook - .xlsx, .xls, .xlsm and .xlsb are read. The table name is seeded from the file name.
  2. Pick the sheet and dialect - PostgreSQL, MySQL or SQLite. The choice changes identifier quoting, the boolean literals and the inferred type names.
  3. Decide on headers and CREATE TABLE - Use row 1 for column names or fall back to Column 1, Column 2; include or omit the CREATE TABLE statement.
  4. Review the script and export - Read the generated SQL in the panel, then copy it or download a .sql file.

What the generated script contains

An optional CREATE TABLE with one column per header and an inferred type, then one INSERT INTO ... VALUES per data row, each carrying the full column list so the statements are order-independent and safe to reorder or split. Statements are separated by a blank line.

CREATE TABLE "sales_2024" (
  "region" TEXT,
  "revenue" DOUBLE PRECISION
);

INSERT INTO "sales_2024" ("region", "revenue") VALUES ('North', 42000);

INSERT INTO "sales_2024" ("region", "revenue") VALUES ('South', 36500.5);

Nothing else is generated: no DROP TABLE, no BEGIN/COMMIT, no primary key, no indexes, no ON CONFLICT or ON DUPLICATE KEY UPDATE, and no schema qualifier. The script is meant to be read before it is run.

How the three dialects differ

DialectIdentifier quotingBooleansNumeric types
PostgreSQL"name", inner quotes doubledTRUE / FALSEINTEGER, DOUBLE PRECISION
MySQL`name`, inner backticks doubledTRUE / FALSEINT, REAL
SQLite"name", inner quotes doubled1 / 0INTEGER, REAL

How each cell becomes a literal

  • Empty cells and empty strings become NULL. There is no way to distinguish a blank cell from a deliberately empty string in the output - if that distinction matters, put a sentinel in the sheet first.
  • Numbers are written unquoted, with floating-point noise trimmed to twelve significant digits so 57.809999999999945 is written as 57.81, matching what Excel displays. An infinite or NaN value becomes NULL.
  • Text is wrapped in single quotes with any embedded single quote doubled, so O'Brien is written 'O''Brien'.
  • Booleans follow the dialect column above.
  • Dates, times, currency and percentages arrive as their raw numbers: 45000, 1234.5, 0.15.
  • Formula cells contribute their cached result, never the formula text.
  • Error cells such as #N/A become NULL.

Edge cases

  • The header row sets the column count.With "first row as headers" on, the width of row 1 decides how many columns exist; cells further right on later rows are dropped. A sheet whose header row is shorter than its data needs the header filled in first.
  • Short rows are padded with NULL, so every INSERT has the same number of values.
  • Backslashes are not escaped. Correct for PostgreSQL and SQLite; a hazard on MySQL, where a backslash is an escape character by default.
  • Merged cells lose their span. Only the top-left cell of a merged range holds the value; the rest of the range inserts as NULL.
  • Numbers stored as text stay text. A column that Excel flags with the green triangle is a column of strings, so it is typed TEXT and quoted in every INSERT. Fix it in the workbook with Convert Text to Number before exporting.
  • Blank leading rows count.The export starts at the sheet's used range, so a title row above the table becomes the header row unless you remove it first.

When to use a different tool

Frequently Asked Questions

Related Tools