Why convert Excel to INSERT scripts
Seed data for test environments, config imports, and backfilling from exports all need bulk INSERT statements. Writing them by hand is slow and error-prone—one missed quote breaks the whole script.
ComTools Excel to SQL is a free online tool: upload .xlsx or .csv, map columns, and generate INSERT scripts you can copy or download as .sql.
Prepare your Excel or CSV file
| Requirement | Details |
|---|---|
| Row 1 | Column headers, e.g. UserId, Email, Age |
| Data rows | One INSERT per row starting from row 2 |
| Column names | Match DB fields when possible; remap in the tool |
| Formats | .xlsx, .xlsm, .csv |
Example:
| UserId | Age | |
|---|---|---|
| 1001 | alice@example.com | 28 |
| 1002 | bob@example.com | 32 |
Steps (INSERT)
- Open Excel to SQL.
- Upload your file; pick the target sheet if there are multiple.
- Set statement type to Insert.
- Enter the table name, e.g.
dbo.Usersorusers. - Choose database type: SQL Server, MySQL, PostgreSQL, SQLite, or Oracle.
- In the column grid, select columns to include and adjust target field names.
- Optional: Batch INSERT (on by default—merges ~500 rows per statement for faster execution).
- Optional: Include CREATE TABLE for new or temp tables.
- Click Generate, then copy or download the SQL.
Single-row INSERT example
INSERT INTO dbo.Users (UserId, Email, Age) VALUES (1001, 'alice@example.com', 28);
INSERT INTO dbo.Users (UserId, Email, Age) VALUES (1002, 'bob@example.com', 32);
Batch INSERT example
INSERT INTO dbo.Users (UserId, Email, Age) VALUES
(1001, 'alice@example.com', 28),
(1002, 'bob@example.com', 32);
Single quotes in strings are escaped automatically; empty cells may become NULL depending on column inference.
Common scenarios
| Scenario | Suggested settings |
|---|---|
| Brand-new table | Enable Include CREATE TABLE + Insert |
| Large import | Keep Batch INSERT on; execute in chunks in your DB |
| Quick preview | Use a temp name like #Preview—tool adds CREATE, INSERT, and SELECT |
| Data from a web table | HTML to Excel first, then this tool |
| Multiple files | Merge → Dedup → Excel to SQL |
Execute in your database
USE YourDatabase;
GO
-- paste generated INSERT statements
Tips:
- Run on a test database first; verify row counts.
- Even with batch mode, commit in chunks of 500–1000 rows when scripts are huge.
- Back up tables before production imports.
Other entry points
| Source | Tool |
|---|---|
| Excel / CSV | Excel to SQL |
| JSON array (API) | JSON to SQL |
| Pasted JSON rows | Generate INSERT |
Excel to SQL series
- Generate UPDATE statements from Excel
- DELETE and CSV import guides (coming soon)
FAQ
How many rows are supported?
Up to 50,000 rows per generation; split very large files if needed.
CSV encoding issues?
Save as UTF-8 when possible; use CSV to Excel to inspect garbled files before generating SQL.
Is my file stored on the server?
The file is parsed server-side to produce SQL. Avoid uploading sensitive production data to untrusted hosts; use test data when possible.
INSERT vs UPDATE?
INSERT adds new rows; UPDATE changes existing rows by WHERE keys. For bulk email or status fixes, see the UPDATE guide.