Go to Sign up
Note: Your files never leave your device. We don't upload, transfer, or store your data.
|
|
|
|
|---|---|---|
|
|
|
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)
| Feature | MySQL | PostgreSQL | SQLite | SQL Server |
|---|---|---|---|---|
| Identifier quoting | `name` | "name" | "name" | [name] |
| String escaping | 'it''s' | E'it\'s' | 'it''s' | 'it''s' |
| Integer type | INT | INTEGER | INT | INT |
| Float type | DOUBLE | DOUBLE PRECISION | DOUBLE | FLOAT |
| Boolean type | TINYINT(1) | BOOLEAN | TINYINT(1) | BIT |
| Date/time type | DATETIME | TIMESTAMP | DATETIME | DATETIME |
| String fallback | TEXT | TEXT | TEXT | NVARCHAR(MAX) |
| Auto-increment | AUTO_INCREMENT | Manual sequence | ROWID | IDENTITY(1,1) |
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.
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.
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.
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.
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.
Given this Excel table:
| id | name | price | active |
|---|---|---|---|
| 1 | Widget A | 29.99 | true |
| 2 | Widget B | 49.99 | false |
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);
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.
The tool analyzes each column's data to determine the appropriate SQL type:
| Excel Data Pattern | MySQL | PostgreSQL | SQL Server |
|---|---|---|---|
| Whole numbers (1, 42) | INT | INTEGER | INT |
| Decimals (3.14, 29.99) | DOUBLE | DOUBLE PRECISION | FLOAT |
| Text ("hello") | TEXT | TEXT | NVARCHAR(MAX) |
| Booleans (true, false) | TINYINT(1) | BOOLEAN | BIT |
| Dates (2025-01-15) | DATETIME | TIMESTAMP | DATETIME |
| Empty / NULL | TEXT | TEXT | NVARCHAR(MAX) |
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.