Excel to SQL Converter

Open an .xlsx file (or paste cells copied from Excel) to get CREATE TABLE and INSERT statements. Pick the sheet and the database; the file never leaves your browser.

Drop an .xlsx file here

Convert an Excel sheet to SQL

Saving a sheet as CSV first loses information: dates turn into whatever text your regional settings show (14/03/2026 or 3/14/2026), and you have to repeat the export for every sheet. This tool reads the .xlsx file directly. It lists every sheet, uses the first row as column names, keeps dates as real dates and writes INSERT statements in your database's syntax.

  • Dates and times are read from Excel's date formats and written as 2026-03-14, 2026-03-14 09:30:15 or 09:30:00, whatever the cell displays. Workbooks that use the 1904 date system (older Mac files) are handled too.
  • Column types are detected from the values: INT, BIGINT, DECIMAL, BOOLEAN, DATE, DATETIME or VARCHAR. Codes with leading zeros, like zip codes and phone numbers, stay text.
  • Tables that start lower down, for example at B3 under a title, work: empty rows and columns before the table are skipped.
  • Text keeps Urdu and other Unicode characters, line breaks and quotes; apostrophes are escaped (O''Brien) so the SQL runs.

Example output

CREATE TABLE `customers` (
  `id` INT,
  `name` VARCHAR(255),
  `joined` DATE,
  `last_login` DATETIME,
  `salary` DECIMAL(18,4),
  `active` BOOLEAN,
  `zip` VARCHAR(255)
);

INSERT INTO `customers` (`id`, `name`, `joined`, `last_login`, `salary`, `active`, `zip`) VALUES
(1, 'Sara Khan', '2026-03-14', '2026-03-14 09:30:15', 150000.5, TRUE, '05400'),
(2, 'Ali O''Brien', '1999-12-31', '2026-11-13 23:59:59', 1.1, FALSE, '00123');

We tested the converter with workbooks written by two different libraries (openpyxl and XlsxWriter): dates, times, booleans, Urdu text, line breaks, leading zeros and numbers above 2,147,483,647 (BIGINT). The generated scripts loaded into MySQL 8.4 and SQLite 3.50, and every value read back matched the spreadsheet.

Good to know

  • Formulas: the value Excel last calculated is used. A file created by a script and never opened in Excel may have no saved results, and those cells come out as NULL. Open and save the file in Excel first.
  • Long numbers: Excel itself keeps only 15 significant digits, so an ID like 9007199254740993 typed as a number is already stored as 9007199254740990. Format ID columns as Text in Excel before typing them.
  • Old .xls files (Excel 97-2003) are not supported. Save them as .xlsx, or copy the cells and paste them into the box.
  • For very large sheets, a bulk loader is faster than INSERT statements: see the guide linked above.

Frequently asked questions

Is my Excel file uploaded?
No. The .xlsx file is unzipped and read by JavaScript in your browser. Nothing is sent to a server.
Which sheet is converted?
The first one, until you pick another from the Sheet list. Each sheet becomes its own table; the table name is taken from the sheet name and can be changed.
Why is a column VARCHAR when it holds numbers?
Because at least one value in it is not a plain number, such as a code with a leading zero (05400), a value with text in it, or a number too large for BIGINT. Change the type in the CREATE TABLE statement if you need to.
Can I paste data instead of opening a file?
Yes. Select the cells in Excel or Google Sheets, copy, and paste them into the box. Copied cells are tab-separated and are detected automatically. Dates are then taken as the text Excel showed.
Which databases are supported?
MySQL and MariaDB, PostgreSQL, SQL Server, SQLite and Oracle. Identifiers are quoted and values are written in each database's syntax.

Related tools