Skip to content

Excel XLSX to SQL converter

XLSX to SQL turns one worksheet into DDL plus INSERT rows, so it is useful for a small seed script but not for preserving workbook behavior.

  • Converted with Table engine · nothing stored
  • Free: 5 conversions a day · 5 MB each
  • Higher limits →

From real runs

What you get — and what changes

  • CREATE TABLE Changed

    The tested output began with CREATE TABLE "Orders", using worksheet-derived column names after merged cells were normalized.

  • INSERT rows Kept

    Each data row became a separate INSERT statement with values in the same order as the flattened worksheet columns.

  • String quoting Changed

    A customer value containing an apostrophe was escaped as Bo O''Connor, which is valid SQL string-literal escaping.

  • Type inference Changed

    Mixed text, dates, and numbers under title-derived columns caused those SQL columns to be declared TEXT in the rich workbook run.

  • Formula cells Changed

    Formula expressions were not serialized; cached numeric results were emitted as SQL literals when the cells were within the sheet range.

  • Multiple sheets Changed

    Only the first IR table was written to SQL in the default API run, and the response included a warning about flattening multiple sheets.

  • Workbook features Lost

    Sheet relationships, lookup tabs, filters, validation rules, comments, and chart objects were absent from the SQL script.

Sample conversions

Orders sheet to seed SQL

Input
17,714-byte XLSX with Orders and Lookups sheets, merged report title, dates, decimals, and an apostrophe in Bo O'Connor.
Output
582-byte SQL included CREATE TABLE "Orders" and VALUES ('A-002', 'Bo O''Connor', '2026-09-11T00:00:00.000Z', 1, 99.99);.

Formula worksheet

Input
Formula workbook with line_total cells defined as B2*C2 and B3*C3.
Output
The Markdown verification for the same parser showed cached totals 39 and 15; SQL follows the same parsed cell values rather than formula text.

A real Excel XLSX → SQL run

We converted our Excel XLSX sample (17 KB) with Table engine on 2026-09-11. It took 1 ms and produced a 688 B SQL file, 96% smaller than the input. The engine raised 2 warnings, listed below.

Input · sample.xlsx · 17 KB

Workbook with 2 sheets (Pipeline, Notes); first sheet 5 rows, 25 cells, 0 formulas

Sheets
2
Sheet names
Pipeline, Notes
Rows
5
Cells
25
Formulas
0
frozenHeader
no

Output · sample.sql · 688 B

1 CREATE TABLE, 4 INSERT statements

CREATE TABLE
1
INSERT statements
4
Lines
5
  • Workbook contains multiple sheets; each sheet was exposed as its own IR table.
  • Only the first table was written to this single-table format.

First lines of the output

sql
CREATE TABLE "Pipeline" ("company" TEXT, "stage" TEXT, "arr" DOUBLE PRECISION, "owner" TEXT, "close_date" TEXT);
INSERT INTO "Pipeline" ("company", "stage", "arr", "owner", "close_date") VALUES ('Northwind Traders', 'Proposal', 48000, 'R. Ayers', '2026-10-14');
INSERT INTO "Pipeline" ("company", "stage", "arr", "owner", "close_date") VALUES ('Contoso Ltd', 'Negotiation', 120000, 'P. Ng', '2026-09-30');
INSERT INTO "Pipeline" ("company", "stage", "arr", "owner", "close_date") VALUES ('Fabrikam', 'Qualified', 22500, 'R. Ayers', '2026-11-02');
INSERT INTO "Pipeline" ("company", "stage", "arr", "owner", "close_date") VALUES ('Tailspin Toys', 'Won', 64000, 'M. Okafor', '2026-09-03');

Options and when to change them

sheet
Choose the worksheet that should become the SQL table when the workbook has lookup or documentation tabs.
headerRowIndex
Set the actual header row so report titles do not become SQL column names.
dialect
Use PostgreSQL or SQLite double-quoted identifiers, or MySQL backticks for scripts headed to MySQL.
tableName
Override the worksheet name when the destination database expects a specific table name.
createTable
Disable it when you already have a schema and only need INSERT statements.

Do it yourself

Python pandas and sqlite3

bash
python - <<'PY'
import pandas as pd, sqlite3
df = pd.read_excel("in.xlsx", sheet_name="Orders", header=1)
con = sqlite3.connect("out.db")
df.to_sql("orders", con, index=False, if_exists="replace")
PY

Export `.dump orders` from sqlite3 if you need a script; review inferred column types before loading production data.

Excel XLSX to SQL by API or MCP

The HTTP API and the MCP server run the exact engine this page uses (Table engine); the response carries the same warnings the web converter shows. Check support first with GET /api/v1/pairs?from=xlsx&to=sql.

curl
curl -X POST https://filetypeconverters.com/api/v1/convert \
  -H "Authorization: Bearer $FTC_API_KEY" \
  -F "file=@input.xlsx" -F "from=xlsx" -F "to=sql" \
  -F 'options={"sheet":""}' \
  --output output.sql

Options this engine accepts for Excel XLSX → SQL

KeyApplies toTypeDefault
sheetReading Excel XLSXstring
headerRowIndexReading Excel XLSXnumber0
dateHandlingReading Excel XLSXdate · stringdate
dialectWriting SQLpostgres · mysql · sqlitepostgres
tableNameWriting SQLstringdata
createTableWriting SQLbooleantrue
API reference

When this is the wrong conversion

  • Use /convert/xlsx-to-csv before loading with your database's bulk importer when the table is large.
  • Do not rely on generated SQL when the workbook needs foreign keys, constraints, indexes, or carefully typed migrations.

Excel XLSX to SQL questions

Does XLSX to SQL execute anything?

No. It writes SQL text for you to inspect and run elsewhere. The local API response was a downloadable .sql file, not a database connection.

How are SQL column names chosen?

Column names come from the parsed worksheet header row. In the merged-heading test, Q3 Orders and generated column_2 names showed why the header row matters.

Can I choose a SQL dialect?

The serializer has PostgreSQL, MySQL, and SQLite quoting modes. In the default run, identifiers were double quoted and strings used doubled apostrophes.