Excel To SQL

Login

Email
Password

Don't have an account yet?

Go to Sign up

{{ workbook ? 'Online Table Editor' : 'Input Data' }}
Change File Enter Data
Row Col Row Col
Transpose Clear Delete Empty Deduplicate
ABC abc Abc
Replace
First Row as Header
{{ displayRows.length }} rows x {{ displayHeaders.length }} columns{{ firstRowAsHeader ? ' (1 header)' : '' }} {{ selectedRows.length > 0 ? selectedRows.length + ' selected' : '' }}
Output Data
{{ copied ? 'Copied!' : 'Copy to Clipboard' }} Download File
Properties
Convert Excel to SQL online — paste, edit, and download SQL.

Drop Table (If Exists):
Add DROP TABLE IF EXISTS before CREATE TABLE
Create Table:
Include CREATE TABLE statement in output
Database Type:
Table Name:
Primary Key:
Specify primary key field for CREATE TABLE
Pretty Print:
Format SQL output with line breaks
Batch Insert:
Combine multiple rows into a single INSERT statement
Convert Restart
Insert Row Below
Insert Row Above
Insert Column Right
Insert Column Left
Delete Row {{ contextMenu.row + 1 }}
Delete Column {{ contextMenu.col + 1 }}
Clear Cell
Clear Row
Case sensitive Use regex Cancel Replace All

What Is SQL?

SQL (Structured Query Language) is the standard language for managing and manipulating relational databases. Two SQL statements are essential when migrating spreadsheet data into a database:  

  • CREATE TABLE — Defines the table schema with column names, data types, and constraints.

  • INSERT INTO — Populates the table with row data from the spreadsheet.

Official documentation: MySQL | PostgreSQL | SQLite | SQL Server (T-SQL)  

SQL Dialect Comparison

FeatureMySQLPostgreSQLSQLiteSQL Server
Identifier quoting`name`"name""name"[name]
String escaping'it''s'E'it\'s''it''s''it''s'
Integer typeINTINTEGERINTINT
Float typeDOUBLEDOUBLE PRECISIONDOUBLEFLOAT
Boolean typeTINYINT(1)BOOLEANTINYINT(1)BIT
Date/time typeDATETIMETIMESTAMPDATETIMEDATETIME
String fallbackTEXTTEXTTEXTNVARCHAR(MAX)
Auto-incrementAUTO_INCREMENTManual sequenceROWIDIDENTITY(1,1)

What Is Excel to SQL?

Excel to SQL is a free online tool that converts spreadsheet data from Excel files (.xlsx, .xls, .xlsm) into SQL CREATE TABLE and INSERT INTO statements. The tool automatically infers SQL data types from your data, supports four database dialects, and handles string escaping and identifier quoting. Everything is processed in your browser — your files are never uploaded to any server.  

Core Features

  • 4 Database Dialects — MySQL, PostgreSQL, SQLite, and SQL Server with dialect-specific type names, identifier quoting, and string escaping.

  • CREATE TABLE Generation — Auto-generates CREATE TABLE with inferred column types and optional PRIMARY KEY constraint.

  • DROP TABLE IF EXISTS — Optionally prepend DROP TABLE IF EXISTS for idempotent migration scripts.

  • Batch Insert — Combine all rows into a single INSERT ... VALUES statement for efficient bulk loading.

  • Auto Type Inference — Analyzes cell values to infer INT, DOUBLE, BOOLEAN/BIT, DATETIME/TIMESTAMP, or TEXT/NVARCHAR.

  • Primary Key Support — Specify a primary key column to add AUTO_INCREMENT (MySQL), IDENTITY(1,1) (SQL Server), or NOT NULL constraints.

  • Pretty Print — Format SQL with line breaks and indentation for readability.

  • String Escaping — Single quotes are properly escaped ('' doubling, PostgreSQL E'' strings).

  • Multi-Sheet Support — Select which worksheet to convert from multi-sheet workbooks.

  • Built-in Table Editor — Edit cells, transpose, deduplicate, and transform data before conversion.

  • 100% Client-Side Processing — No data leaves your device.

How to Use Excel to SQL?

Step 1: Upload or Enter Your Data

Drag and drop an Excel file (.xlsx, .xls, or .xlsm) onto the upload area, or click to browse. Alternatively, click Enter Data to type table data manually.  

Step 2: Edit Your Data (Optional)

After loading, your data appears in an editable table. Use the toolbar to modify cells, add or remove rows and columns, transpose data, remove duplicates and empty rows, change text case, or find and replace values. Toggle First Row as Header to define column names.  

Step 3: Configure SQL Options

In the Properties panel on the right:  

  • Database Type — Select your target database: MySQL, PostgreSQL, SQLite, or SQL Server. Each dialect generates different type names, identifier quoting, and DROP TABLE syntax.

  • Table Name — Enter the target table name (default: tableName).

  • Drop Table (If Exists) — Enable to prepend DROP TABLE IF EXISTS before CREATE TABLE. Useful for repeatable migration scripts.

  • Create Table — Enable to include the CREATE TABLE statement with inferred column types. Disable to generate only INSERT statements.

  • Primary Key — Enter a column name to mark as PRIMARY KEY with auto-increment support.

  • Batch Insert — Enable to combine all rows into a single INSERT ... VALUES statement. Disable for one INSERT per row.

  • Pretty Print — Enable for formatted SQL with line breaks. Disable for compact single-line output.

Conversion Example

Given this Excel table:

idnamepriceactive
1Widget A29.99true
2Widget B49.99false

MySQL output with all options enabled, Primary Key = "id":

DROP TABLE IF EXISTS `products`;
CREATE TABLE `products` (
 `id` INT NOT NULL AUTO_INCREMENT,
 `name` TEXT,  `price` DOUBLE,
 `active` TINYINT(1),
 PRIMARY KEY (`id`)
);

INSERT INTO `products`
 (`id`, `name`, `price`, `active`)VALUES
 (1, 'Widget A', 29.99, 1),
 (2, 'Widget B', 49.99, 0);

Step 4: Copy or Download

Click Copy to Clipboard to copy the SQL into your database client or migration script. For file download, use the Download button (requires Premium Plan). The file is saved with a .sql extension.  

SQL Type Inference Reference

The tool analyzes each column's data to determine the appropriate SQL type:

Excel Data PatternMySQLPostgreSQLSQL Server
Whole numbers (1, 42)INTINTEGERINT
Decimals (3.14, 29.99)DOUBLEDOUBLE PRECISIONFLOAT
Text ("hello")TEXTTEXTNVARCHAR(MAX)
Booleans (true, false)TINYINT(1)BOOLEANBIT
Dates (2025-01-15)DATETIMETIMESTAMPDATETIME
Empty / NULLTEXTTEXTNVARCHAR(MAX)

Common Use Cases

  • Database Migration — Convert spreadsheet data into SQL scripts for importing into MySQL, PostgreSQL, SQLite, or SQL Server databases.

  • Seed Data — Generate INSERT statements from Excel fixture files for development and test databases.

  • Schema Prototyping — Rapidly prototype database schemas by defining tables in Excel and generating CREATE TABLE statements.

  • Data Import for CMS — Convert product catalogs, user lists, or configuration data from Excel into SQL for WordPress, Drupal, or custom CMS databases.

  • ETL Prototyping — Generate SQL from staging spreadsheets before building production ETL pipelines.

  • Legacy Data Conversion — Transform data from legacy Excel-based systems into SQL databases during system modernization.

  • Database Testing — Create test data sets in Excel and generate SQL INSERT scripts for automated testing.

Frequently Asked Questions (FAQ)

  • Is my Excel data uploaded to a server?

    No. All file parsing and SQL generation happens entirely in your browser using client-side JavaScript. Your files are never uploaded, transferred, or stored on any server. The tool works offline once the page has loaded.

  • What Excel file formats are supported?

    The tool supports .xlsx (Excel 2007+), .xls (Excel 97-2003), and .xlsm (macro-enabled) files. Multi-sheet workbooks are supported — use the sheet selector to choose which sheet to convert.

  • How does the tool infer SQL data types?

    The tool scans each column's values and matches the first non-empty cell against type rules: whole numbers become INT, decimals become DOUBLE/FLOAT, booleans become TINYINT(1)/BOOLEAN/BIT, dates become DATETIME/TIMESTAMP, and everything else becomes TEXT/NVARCHAR(MAX). Type names vary by database dialect.

  • What is the difference between single and batch INSERT?

    Single INSERT (default) generates one INSERT INTO ... VALUES (...) statement per row. Batch INSERT combines all rows into a single INSERT INTO ... VALUES (...), (...), (...) statement. Batch mode is more efficient for large datasets because the database executes one statement instead of hundreds. Single mode is easier to debug and edit manually.

  • How are string values escaped?

    Single quotes within string values are escaped by doubling them ('it''s'). PostgreSQL uses E'' escape strings with backslash escaping. Empty cells are converted to NULL. Numeric and boolean values are inserted unquoted.

  • How does the Primary Key option work?

    Enter a column name (e.g., id) in the Primary Key field. The tool adds a PRIMARY KEY (column) constraint to the CREATE TABLE statement. For MySQL, the column also gets NOT NULL AUTO_INCREMENT. For SQL Server, it gets IDENTITY(1,1) NOT NULL. For PostgreSQL and SQLite, it gets NOT NULL.

  • What is DROP TABLE IF EXISTS for?

    DROP TABLE IF EXISTS is prepended before CREATE TABLE to make the SQL script idempotent — it can be run repeatedly without errors. This is useful during development and testing when you frequently recreate tables. SQL Server uses IF OBJECT_ID(...) IS NOT NULL DROP TABLE since it doesn't support DROP TABLE IF EXISTS in older versions.

  • Can I edit the data before converting?

    Yes. After uploading your file, the built-in table editor lets you modify cell values, add or remove rows and columns, transpose data, remove duplicates and empty rows, change text case, and find-and-replace — all before generating the SQL.

  • Can I use this tool without uploading a file?

    Yes. Click the Enter Data button to open a blank editor where you can type or paste table data manually, then generate the SQL statements.

  • What identifier quoting does each dialect use?

    Table and column names are quoted to prevent conflicts with SQL reserved words. MySQL uses backticks (`name`). PostgreSQL and SQLite use double quotes ("name"). SQL Server uses square brackets ([name]). This ensures the generated SQL is valid even if column names match SQL keywords like ORDER, GROUP, or INDEX.

Featured Tools

Featured tools that you might find useful.

Popular Tools

List of popular tools that users love and frequently use.

New Tools

The latest tools added to our collection, designed for you.

Topics

The tools grouped by topics to quickly find what you need.
Free online Excel to JSON converter. Transform XLSX, XLS, XLSM files into JSON arrays, objects, or keyed formats instantly in your browser — no upload, 100% private.

Excel To JSON

Free online Excel to JSON converter. Transform XLSX, XLS, XLSM files into JSON arrays, objects, or keyed formats instantly in your browser — no upload, 100% private.
Free Excel to CSV converter. Convert XLSX, XLS, XLSM to CSV instantly in your browser. No upload, 100% private. Edit, transpose, deduplicate before exporting.

Excel To CSV

Free Excel to CSV converter. Convert XLSX, XLS, XLSM to CSV instantly in your browser. No upload, 100% private. Edit, transpose, deduplicate before exporting.
Free online Excel to SQL converter. Generate CREATE TABLE and INSERT statements from spreadsheets for MySQL, PostgreSQL, SQLite, and SQL Server. Supports batch insert, primary keys, and type inference.

Excel To SQL

Free online Excel to SQL converter. Generate CREATE TABLE and INSERT statements from spreadsheets for MySQL, PostgreSQL, SQLite, and SQL Server. Supports batch insert, primary keys, and type inference.
Free online Excel to ASCII table converter with 10 border styles (MySQL, Unicode, reStructuredText, and more). Add code comment wrappers in 8 languages. Supports text alignment. Client-side processing.

Excel To ASCII Table

Free online Excel to ASCII table converter with 10 border styles (MySQL, Unicode, reStructuredText, and more). Add code comment wrappers in 8 languages. Supports text alignment. Client-side processing.