Excel to SQL INSERT
Generate INSERT statements from a worksheet — identifiers quoted, every value escaped, empty cells as NULL.
What is Excel to SQL INSERT
Excel to SQL conversion treats the first row as column names and every following row as values, emitting INSERT statements. Identifiers made of safe characters are used as-is and anything else is double-quoted; values have single quotes doubled. Empty cells become NULL rather than empty strings.
File
🔒 Everything runs in your browser. Nothing is uploaded.
What this tool actually does with your file
- Where it runs
- In your browser, on this page
- Upload
- None — the file never leaves your device
- Offline
- Works with the network disconnected
What the generated INSERT statements look like
One INSERT per row, with the sheet name or a chosen table name as the target. Each value is quoted according to its type: numbers bare, text in single quotes with embedded quotes doubled, empty cells as NULL. That is the subset every SQL dialect accepts.
Identifiers are quoted with double quotes (standard SQL) rather than backticks or brackets, and characters that are not safe in an identifier are replaced with an underscore. A column called Total ($) becomes "Total (__)" — ugly but valid, and it will not break the statement.
The output is a script, not a migration. It has no CREATE TABLE, no transaction wrapper and no type inference beyond number versus text. Run it against a table you created, or use it as a starting point and add the DDL yourself.
The three ways this goes wrong in practice
Dates. Excel stores a date as a serial number, so a naive export writes 46336 where you expected 2026-11-20. This converter writes real dates as ISO strings, but a date typed as text stays text and may not match the target column's date type.
Large files. A hundred thousand rows produce a hundred thousand INSERT statements and a script that most clients refuse to run in one go. Batch it, or load the CSV with the database's own COPY/LOAD DATA command, which is orders of magnitude faster.
Encoding and reserved words. A column named order or group is a reserved word in most dialects; quoting handles it, but hand-written follow-up queries will still need the quotes.
How to use it
- 1.Choose an .xlsx file
- 2.Set the table name (defaults to the file name)
- 3.Run it, then copy the INSERT statements
How Excel to SQL INSERT works under the hood
An .xlsx file is not a table — it is a ZIP archive of XML parts. Everything you see as a grid is rebuilt from cell references on this page, in memory, without a round trip to a server.
- 1
Read the file as bytes
The file is read into an ArrayBuffer with the File API. This is a local read, not a request — nothing leaves the tab.
- 2
Unzip and parse the workbook
SheetJS inflates the archive, reads workbook.xml for sheet order, sharedStrings.xml for text, and each sheet's XML for cells and types.
- 3
Rebuild rows in memory
Cells are placed by their A1 reference, gaps become empty cells, and the sheet is materialised as a two-dimensional array.
- 4
Write the output locally
The result is serialised to CSV text or a new workbook and handed to the browser as a Blob download.
Processing pipeline
Why formulas arrive as values
A spreadsheet stores two things per formula cell: the formula text, and the value Excel last computed and cached. A browser parser reads the cached value. Making the formula itself run would mean reimplementing Excel's calculation engine — including volatile functions, circular-reference detection and locale-specific parsing. So the exported CSV contains what you last saw on screen, not a live formula.
What has no CSV equivalent
Merged cells, cell fills, fonts, conditional formatting, comments and pivot tables have no representation in a comma-separated file. A merged cell becomes its value in the top-left position and empty cells elsewhere. Dates are written as dates only when the cell is typed as a date; a date stored as text stays text. These are format limits, not bugs.
Where it gets slow
Parsing is linear in cell count, and the browser holds the whole workbook in memory. A 30 MB file with a million populated cells can take several seconds and a few hundred MB of RAM; the tab may feel frozen while SheetJS works. Splitting the file by sheet, or exporting only the range you need, is faster than retrying with a bigger limit.
Verify it yourself
You do not have to take this on faith. Run the tool once with DevTools open.
- 1.Open DevTools on this page and switch to the Network tab
- 2.Keep the filter on Fetch/XHR and run the tool
- 3.Confirm no request carries your file — you should see only page assets and fonts
Frequently asked questions
Which databases does the output target?
Standard INSERT ... VALUES syntax works on PostgreSQL, MySQL and SQLite. Identifiers use double quotes (standard SQL); if your MySQL runs without ANSI_QUOTES, swap them for backticks.
Is the output safe from SQL injection?
Values are escaped by doubling single quotes and identifiers are quoted unless they match a safe pattern. Still review generated SQL before running it in production — a tool cannot know what the data means.
What about empty cells?
They become NULL. If you want empty strings instead, replace them afterwards.
Does it handle large sheets?
A few thousand rows are fine. Hundreds of thousands make one statement unusably large — convert to CSV and use COPY / LOAD DATA instead.
What this kind of conversion cannot keep
Spreadsheet conversion is lossy by nature: a workbook carries formulas, styles, merged cells and multiple sheets, while CSV carries rows of text. This tool keeps values and order, recalculates nothing, and drops presentation on purpose. That is why it can run without a server — and why a converted file will not look like the original.
More in Spreadsheets & Docs
On this page
- What is Excel to SQL INSERT
- What this tool actually does with your file
- How it actually behaves
- How to use it
- How it works inside
- Frequently asked questions
Excel formula reference
29 functions with syntax, arguments and a table you can retype.
Browse the list →