Drop an Excel workbook or paste a range of cells and get a CREATE TABLE statement with inferred column types plus batched INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server. Dates, numbers and TRUE/FALSE cells keep their real Excel types, and nothing leaves your device.
Last updated:
Sample workbook loaded
Sheet preview
Columns
Rename a column or override its detected type. Changes apply instantly to the current sheet.
Cell
Column name
Type
Detected
Blank
Example
Advertisement
Advertisement
How to use the Excel to SQL Converter
Drop your workbook (.xlsx, .xls or .ods) or switch to the paste tab and paste a copied range.
Choose the sheet and header row. Click a row number in the preview to use that row as column names.
Pick the SQL dialect, table name, rows per INSERT and primary key option.
Review the columns: rename them, override a detected type or skip columns you do not need.
Copy or download the .sql file and run it in your database client.
How Excel cell types map to SQL
Excel cells in the column
MySQL
PostgreSQL
SQLite
SQL Server
Whole numbers (42, -7)
INT
INTEGER
INTEGER
INT
Whole numbers above 2,147,483,647
BIGINT
BIGINT
INTEGER
BIGINT
Numbers with decimals (19.95)
DECIMAL(p,s)
NUMERIC(p,s)
REAL
DECIMAL(p,s)
TRUE / FALSE
BOOLEAN
BOOLEAN
INTEGER (1/0)
BIT (1/0)
Date-formatted cells
DATE
DATE
TEXT (ISO)
DATE
Date and time cells
DATETIME
TIMESTAMP
TEXT (ISO)
DATETIME2
Time-only cells (09:30)
TIME
TIME
TEXT
TIME
Text up to 255 characters
VARCHAR(n)
VARCHAR(n)
TEXT
NVARCHAR(n)
Longer text
TEXT
TEXT
TEXT
NVARCHAR(MAX)
For DECIMAL(p,s), p is the total number of digits and s the digits after the decimal point, both taken from the widest value in the column. Excel stores numbers as 64-bit floating point, so a value such as 0.1 + 0.2 is rounded to 15 significant digits (0.3) before it is written, the same precision Excel itself displays.
Excel dates and the 1900 date system
A date in Excel is a number: 1 is 1 January 1900 and 45,306 is 15 January 2024. The fraction is the time of day, so 45,306.5 is noon. Excel also counts a 29 February 1900 that never existed, a leftover from early spreadsheet compatibility, so serial numbers from 1 to 60 are shifted by one day. Workbooks saved with the Mac 1904 date system start counting on 1 January 1904. The converter handles all three cases and writes dates as 'YYYY-MM-DD' and date-times as 'YYYY-MM-DD HH:MM:SS', formats that MySQL, PostgreSQL, SQLite and SQL Server all parse.
Tips for a clean import
One header row, one table. Remove titles, notes and totals above or below the data, or set the header row number so they are skipped.
Merged cells only keep a value in their top-left cell; the other cells of the merge become NULL. Unmerge and fill them in Excel first if that matters.
Mixed columns (numbers and text in the same column) are typed as VARCHAR so no row fails to insert. Override the type in the column list if the text values are mistakes you will fix.
Very large sheets import faster with the database's bulk loader. Save the sheet as CSV and use LOAD DATA INFILE (MySQL), \copy (PostgreSQL), .import --csv (SQLite) or BULK INSERT (SQL Server); you can still use this page to generate the CREATE TABLE statement.
Wrap the script in a transaction so a single bad row rolls back the whole import instead of leaving half a table.
Frequently asked questions
How does the converter decide each column type?
It looks at every non-blank cell in the column. Whole numbers become INT (BIGINT above 2,147,483,647), numbers with decimals become DECIMAL sized to the widest value, cells formatted as dates become DATE or DATETIME, time-only cells become TIME, TRUE/FALSE cells become BOOLEAN, and everything else becomes VARCHAR sized to the longest value, or TEXT above 255 characters.
Why do my Excel dates come out as dates and not numbers?
Excel stores dates as serial numbers (days since 1 January 1900) and only the cell's number format marks them as dates. The converter reads that format and turns the serial number into an ISO date such as 2024-01-15, which every SQL dialect accepts as a date literal.
Can I convert every sheet of a workbook at once?
Yes. Tick "All sheets" and the script contains a CREATE TABLE and INSERT block for each worksheet, with table names taken from the sheet names. Column renames and type overrides apply to the sheet that is currently selected; the other sheets use the detected types.
What happens to empty cells and Excel errors?
Blank cells become NULL. Error values such as #N/A, #DIV/0! or #REF! are also written as NULL and counted in the status line so you can find and fix them in the workbook. Rows that are completely empty are skipped unless you turn that option off.
Does it keep leading zeros in codes like zip codes?
Yes, as long as Excel stored them as text (for example 02134 typed into a Text-formatted cell). Such columns stay VARCHAR so the zeros are not lost. If the cell was stored as a number, Excel already dropped the zero before the file was saved.
Are formulas converted?
The converter uses the value Excel saved with the file (the last calculated result), not the formula itself. SQL has no equivalent of a cell formula, so the computed values are what you normally want in a table.
Is my spreadsheet uploaded?
No. The workbook is opened with JavaScript inside your browser tab and the SQL is generated there too. Older .xls and .ods files need the open-source SheetJS reader, which is downloaded from a CDN the first time; your file still stays on your device.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.