Excel to SQL Converter
Upload an .xlsx workbook and get INSERT statements or a CREATE TABLE script with inferred column types — for SQL Server, PostgreSQL, MySQL, Oracle, or SQLite. The file is parsed entirely in your browser; nothing is uploaded.
Click to choose a file or drag an .xlsx workbook here
Classic Oracle doesn't accept multi-row VALUES lists, so each row gets its own INSERT statement. Date and timestamp values are emitted as DATE '…' / TIMESTAMP '…' literals so they don't depend on the session's NLS_DATE_FORMAT.
How type inference works
Unlike a CSV file, an .xlsx workbook already stores each cell with a real type — number, date, boolean, or text — so the converter reads that type directly instead of re-parsing displayed text. It still scans every value in every column before picking a CREATE TABLE type, the same way the CSV to SQL converter does:
- All-integer columns become
INT, promoted toBIGINTwhen any value exceeds the 32-bit range (±2,147,483,647). - Decimal columns become
DECIMAL(p,s)with precision and scale sized from the widest value actually present. - Date cells with no time component become
DATE; date cells with a time component map to the engine's native datetime type (DATETIME2,TIMESTAMP,DATETIME). - Excel's
TRUE/FALSEcells map to the engine's boolean equivalent. - Everything else becomes a text type sized to the next bucket above the longest value (50 / 100 / 255 / 1000, then
MAX/TEXT/CLOB). - A text cell holding something like
007— a zip code or product code typed as text so Excel doesn't strip the leading zero — stays text in the generated schema too. - Columns with no empty cells are marked
NOT NULL.
Formula cells are read by their last-calculated result — the cached value Excel wrote when the file was saved — not re-evaluated. A formula that last resolved to an error is treated as an empty cell. As with any inference tool, treat the generated DDL as a solid first draft: no primary keys, foreign keys, or indexes are guessed, and a column that looks numeric in your sample may still be semantically text.
Multiple sheets
If the uploaded workbook has more than one sheet, a sheet picker appears below the upload area listing every sheet by name. The converter reads the first sheet by default; switching the dropdown re-generates the SQL from the newly selected sheet immediately, without re-uploading the file.
Engine differences that matter when bulk-inserting
- SQL Server — a single
INSERT … VALUESstatement is hard-capped at 1,000 row value expressions (error 10738), so the converter batches at 500 rows per statement. Text columns are generated asNVARCHARrather thanVARCHAR, since spreadsheet text is Unicode in practice. - Oracle — classic Oracle doesn't support multi-row
VALUESlists (that arrived in Database 23ai), so the output is oneINSERTper row. Dates are emitted asDATE '2024-03-01'andTIMESTAMP '…'literals so the script doesn't depend on a session'sNLS_DATE_FORMAT. - Identifier quoting — SQL Server uses
[brackets], MySQL uses`backticks`, and PostgreSQL, Oracle, and SQLite use"double quotes". Column headers with spaces or special characters (common in spreadsheets — "First Name", "Order #") get quoted automatically; simple lowercase names don't. - MySQL — multi-row
VALUEShas no row cap, but very large statements can exceedmax_allowed_packet; 500-row batches keep each statement comfortably small. - SQLite — there are no
VARCHAR(n)semantics, so text, dates, and datetimes all becomeTEXT— the idiomatic way to store ISO-8601 values in SQLite.
BULK INSERT/bcp, COPY, LOAD DATA INFILE, SQL*Loader, or .import — which is orders of magnitude faster than INSERT statements.Frequently asked questions
How do I convert an Excel file to SQL INSERT statements?
Click the upload area above and choose an .xlsx file (or drag one in), set the table name and target engine, and copy the generated INSERT statements. The first row of the sheet is treated as column headers by default. Everything is parsed and converted locally in your browser — the file is never uploaded anywhere.
Does this tool support .xls files?
No, only the modern .xlsx format (Office Open XML, used by Excel 2007 and later, and exported by Google Sheets and LibreOffice Calc). The legacy .xls binary format from Excel 97-2003 is not supported. If you have an .xls file, open it in Excel, Google Sheets, or LibreOffice Calc and use "Save As" / "Download" to save it as .xlsx first.
What happens if my workbook has multiple sheets?
A sheet picker appears once the workbook is parsed, listing every sheet by name. The first sheet is selected by default; switching sheets regenerates the SQL immediately from the newly selected sheet's data without re-uploading the file.
How many rows can I convert?
The converter generates SQL for up to 5,000 data rows per sheet. If the sheet has more, it emits the first 5,000 and shows a warning instead of silently truncating. For bigger loads use a bulk import tool — BULK INSERT or bcp for SQL Server, COPY for PostgreSQL, LOAD DATA INFILE for MySQL, SQL*Loader for Oracle, or .import in the SQLite CLI.
How are data types chosen for CREATE TABLE?
Excel cells already carry a real type — number, date, boolean, or text — and the converter reads that directly rather than re-guessing it from displayed text. Every value in every column is then scanned to pick the narrowest SQL type that fits all of them: all-integer columns become INT (BIGINT when a value exceeds the 32-bit range), decimal cells become DECIMAL(p,s) sized from the widest value, date cells become DATE or the engine's datetime type depending on whether a time component is present, and Excel's TRUE/FALSE cells map to the engine's boolean equivalent. Everything else becomes a text type sized to the next bucket above the longest value. Columns with no empty cells are marked NOT NULL.
How are empty cells and formulas handled?
By default empty cells become NULL. Uncheck "Empty fields as NULL" to insert empty strings ('') into text columns instead. Formula cells are read by their last-calculated result (the value Excel had cached when the file was saved) — the formula itself is not evaluated or included. A formula that last evaluated to an error (like #DIV/0!) is treated as empty.
Is my spreadsheet uploaded anywhere?
No. The workbook is read and parsed entirely in your browser using the open-source ExcelJS library, vendored locally on this page rather than loaded from a CDN. The file never leaves your machine and no network request is made with its contents — you can disconnect from the internet after the page loads and it keeps working.
Loading spreadsheets into a real database?
Jam SQL Studio is a free desktop SQL client for SQL Server, PostgreSQL, MySQL, Oracle, and SQLite — import CSV, XLSX, and JSON files straight into a new or existing table with a guided wizard, browse and edit table data in a spreadsheet-like grid, and export results in any format.
Free for personal use • No account required • Mac, Windows, Linux
More free SQL tools
All Free SQL Tools
The full collection — formatters, converters, and generators for everyday SQL work.
CSV to SQL Converter
Paste CSV or spreadsheet data and get INSERT statements or a CREATE TABLE script with inferred column types.
CSV to JSON Converter
Paste or upload CSV and get a pretty-printed JSON array or NDJSON, with types inferred per column.
SQL Data Type Converter
Map data types across SQL Server, PostgreSQL, MySQL, Oracle, and SQLite — with precision and pitfall notes.
Jam SQL Studio