SQL to Excel Converter
Paste SQL INSERT statements or a database dump and download the data as an Excel workbook - one sheet per table, with proper types.
How to Convert SQL to Excel
- Paste your dump or upload a .sql file - a whole mysqldump, a fragment, or a handful of INSERT statements all work.
- Check the summary - the banner reports how many tables and rows were found before you commit to a download.
- Download the workbook - one sheet per table, column names as row 1.
What the parser looks for
The text is scanned for INSERT INTO statements. The table name may be bare or wrapped in backticks, double quotes or square brackets, and a schema prefix is stripped - dbo.people, `people` and people are all the same table. After VALUES, every parenthesised tuple is read until something that is not a tuple appears, so a multi-row insert of ten thousand tuples is one statement and ten thousand rows.
Column names are taken from the first of these that exists:
- The column list in the INSERT itself.
- A
CREATE TABLEfor the same table anywhere in the same text. Column definitions are read in order and constraint lines - those beginningPRIMARY,FOREIGN,UNIQUE,CONSTRAINT,KEY,CHECKorINDEX- are skipped, so they do not turn into phantom columns. - Generated names
Column1,Column2and so on, from the width of the first tuple.
The tuple splitter is quote- and paren-aware, which is what lets a value containing a comma survive. 'Paris, France' stays one value, and a nested call such as POINT(1, 2) is not split down the middle.
How each literal becomes a cell
| In the dump | In the sheet |
|---|---|
NULL, null | Empty cell |
TRUE, false | Boolean TRUE / FALSE |
42, -3.5, 1.2e3 | Number |
'Ada', '00123', '2024-01-05' | Text, exactly as written |
'O''Brien', 'line1\nline2' | Unescaped to O'Brien and a real line break |
NOW(), 0x41, DEFAULT | The literal text, unevaluated |
Edge cases
- A dump with no INSERTs converts to nothing. Schema-only files, or exports that use
COPYorLOAD DATAto carry the rows, produce the "No INSERT statements found" message. Re-export with your tool's "complete inserts" or "extended inserts" option. - Ragged tuples are not padded. If two INSERTs into the same table carry different numbers of values, the shorter rows simply end early rather than being filled to the header width.
- A column list containing a bracket confuses the match. The column list is read up to the first closing parenthesis, so a column name containing one is not handled.
- Dates and decimals stay strings when the dump quotes them. Most dumps quote both. A
DECIMALcolumn written as'1234.50'arrives as text, keeping the trailing zero. - Binary and blob columns come through as their literal text, which for a large blob means a very long cell. A single value over 32,767 characters exceeds what an Excel cell can hold, and the download fails rather than quietly truncating - strip those columns out of the dump first.
- Very long dumps are parsed in one pass in the browser tab; a multi-gigabyte production dump is better split before it gets here.
When to use a different tool
- You have query results rather than a dump - most clients export CSV: CSV to Excel.
- Tab-separated output from
mysql -Borpsql: TSV to Excel. - Going the other way, worksheet rows to INSERT statements: Excel to SQL.
- JSON exported by an API rather than a database: JSON to Excel or JSONL to Excel.
Frequently Asked Questions
Only INSERT INTO ... VALUES, in any casing, with or without a column list, and with as many parenthesised tuples as you like after VALUES. CREATE TABLE is read for one purpose only - to supply column names when an INSERT has no column list. Everything else in the file is skipped: UPDATE, DELETE, INSERT ... SELECT, MySQL's INSERT ... SET syntax, PostgreSQL's COPY ... FROM stdin blocks, ALTER, comments and stored procedures.
Because a SQL dump writes dates as quoted strings, and a quoted literal is imported as text so that it survives exactly as written. '2024-01-05' becomes the text 2024-01-05, not an Excel date. Select the column in Excel and use Data > Text to Columns with a Date column format, or the Excel Date Converter tool, to turn them into real dates.
NULL in any casing becomes an empty cell. TRUE and FALSE become Excel booleans. An unquoted number, including a negative or one in exponent notation, becomes a number. A single-quoted literal becomes text, with '' and \' unescaped to a quote, \\ to a backslash and \n to a line break. Anything else - a function call such as NOW(), a hex literal such as 0x41, a bare identifier - is carried through as its literal text.
Deliberately. The quotes in the dump say the database column is a string, and account numbers, ZIP codes and product codes stored as strings lose their leading zeros the moment they become numbers. Only unquoted numeric literals are converted to numbers.
All the rows land on one sheet. Statements are grouped by table name, case-insensitively, and a schema prefix is stripped first, so INSERT INTO dbo.people and INSERT INTO people are the same table. The sheet is named after the table, cleaned of the characters Excel forbids and cut to 31 characters, with a number appended if two tables clean to the same name.
No. The file is read and parsed in your browser and nothing is sent to ExcelTool.io - which matters more here than on most pages, because a dump often holds production data. A .sql file exported by SQL Server's wizard or by bcp -w is UTF-16, and that is detected from the bytes rather than assumed, so it does not arrive full of NUL characters.