ExcelTool.io

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

  1. Paste your dump or upload a .sql file - a whole mysqldump, a fragment, or a handful of INSERT statements all work.
  2. Check the summary - the banner reports how many tables and rows were found before you commit to a download.
  3. 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:

  1. The column list in the INSERT itself.
  2. A CREATE TABLE for the same table anywhere in the same text. Column definitions are read in order and constraint lines - those beginning PRIMARY, FOREIGN, UNIQUE, CONSTRAINT, KEY, CHECK or INDEX - are skipped, so they do not turn into phantom columns.
  3. Generated names Column1, Column2 and 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 dumpIn the sheet
NULL, nullEmpty cell
TRUE, falseBoolean TRUE / FALSE
42, -3.5, 1.2e3Number
'Ada', '00123', '2024-01-05'Text, exactly as written
'O''Brien', 'line1\nline2'Unescaped to O'Brien and a real line break
NOW(), 0x41, DEFAULTThe literal text, unevaluated

Edge cases

  • A dump with no INSERTs converts to nothing. Schema-only files, or exports that use COPY or LOAD 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 DECIMAL column 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

Frequently Asked Questions

Related Tools