Excel to HTML & SQL
Open a sheet and get ready-to-paste code. Numbers stay numbers, empty cells become NULL and text is escaped.
- Open your Excel or CSV file
- Choose HTML or SQL and the table name
- Copy or download the code
Your files never leave your device
What this tool does
It reads a spreadsheet and writes code you can paste into a web page or a database. Open an Excel or CSV file, choose HTML table, SQL for PostgreSQL and SQLite, or SQL for MySQL, and enter the table name. Numbers stay numbers, empty cells become NULL in SQL and text is escaped so quotes and angle brackets do not break the code.
- The first row is used as column names unless you untick the header option.
- SQL column types are guessed as INTEGER, DOUBLE PRECISION or TEXT. Check them before importing.
- Large sheets are cut at 100,000 rows to keep the browser responsive.
A worked example
Imagine a sheet with the columns Name, Qty and Note, where one row has the name O'Brien, a quantity of 3 and an empty note. In SQL the name is written with its apostrophe escaped, the quantity as a plain number and the empty note as NULL. The column Qty is guessed as INTEGER and the other two as TEXT.
With the HTML option the same row becomes a table row with plain cells, and special characters such as an ampersand are converted so the browser shows them correctly.
Limits and good practice
The guessed column types are a starting point. A column that mixes numbers and text becomes TEXT, and a long number such as a phone number may be better stored as text, so review the table definition before you run it. In SQL, cells that Excel stores as dates are written as their underlying serial number, while the HTML output shows them as formatted in the sheet, so convert dates to text first if you need readable dates in a database.
Use the table name exactly as your database expects, without spaces. Test the SQL on a copy of your database first, and do not paste data that contains secrets into a shared environment. The HTML has no styling, so add your own CSS.
Frequently asked questions
Is my file uploaded?
No. The sheet is read and converted on your device and never leaves it.
Which databases are supported?
Standard SQL with double quotes for PostgreSQL and SQLite, and a MySQL option that uses backticks.
How are dates handled?
In the HTML output they appear as formatted in the sheet. In the SQL output a date cell is written as its underlying Excel number, so convert the column to text in the sheet first if you need readable dates.
Are special characters escaped?
Yes. HTML characters and SQL quotes are escaped so the code stays valid.
Can I choose another sheet?
Yes. When the workbook has several sheets, pick the one you want.
Is the HTML styled?
No. You get a plain table that you can style with your own CSS.