User Guide
Overview
The CSV → SQL Import Helper converts CSV files into CREATE TABLE and INSERT statements for SQLite, PostgreSQL or MySQL. This tool infers column types, handles special characters and generates production-ready SQL that you can run directly in your database.
Perfect for migrating spreadsheet data to databases, prototyping schemas or generating INSERT statements for test data.
When to Use This Tool
Use this tool when:
- Importing Excel or Google Sheets exports into a SQL database
- Prototyping database schemas from sample data
- Generating INSERT statements for test fixtures
- Migrating data from flat files to relational databases
- Creating tables with proper types without writing SQL by hand
- Learning SQL by seeing how CSVs map to database structures
How to Use
1. Upload or Paste CSV
Click "Upload File" or paste CSV content directly. The first row must be column headers.
2. Select SQL Dialect
Choose SQLite, PostgreSQL or MySQL. Each generates dialect-specific syntax (e.g., INTEGER vs INT, TEXT vs VARCHAR).
3. Generate SQL
Click "Generate SQL" to create CREATE TABLE and INSERT statements. The tool infers column types from your data.
4. Copy and Run
Copy the generated SQL and run it in your database client (psql, mysql, sqlite3) or use the SQLite Playground for instant testing.
Supported SQL Dialects
SQLite
- Uses INTEGER PRIMARY KEY for auto-increment
- TEXT type for strings
- REAL for decimals
- Simple INSERT statements
PostgreSQL
- Uses SERIAL PRIMARY KEY for auto-increment
- VARCHAR for strings
- NUMERIC for decimals
- Supports RETURNING clause
MySQL
- Uses INT AUTO_INCREMENT PRIMARY KEY
- VARCHAR for strings
- DECIMAL for decimals
- Backtick quoting for identifiers
Examples
Sample CSV Input
product_id,product_name,price,in_stock
1,Widget,9.99,true
2,Gadget,19.99,false
3,Doohickey,14.99,trueGenerated SQL (SQLite)
CREATE TABLE imported (
product_id INTEGER,
product_name TEXT,
price REAL,
in_stock TEXT
);
INSERT INTO imported (product_id, product_name, price, in_stock) VALUES
(1, 'Widget', 9.99, 'true'),
(2, 'Gadget', 19.99, 'false'),
(3, 'Doohickey', 14.99, 'true');Generated SQL (PostgreSQL)
CREATE TABLE imported (
product_id INT,
product_name VARCHAR(255),
price NUMERIC,
in_stock VARCHAR(255)
);
INSERT INTO imported (product_id, product_name, price, in_stock) VALUES
(1, 'Widget', 9.99, 'true'),
(2, 'Gadget', 19.99, 'false'),
(3, 'Doohickey', 14.99, 'true');Limitations and Considerations
- Type Inference is Basic: The tool samples values but cannot detect all nuances. Review and adjust types as needed.
- No Foreign Keys: Generated SQL creates a single table. Add relationships manually.
- No Indexes: For performance, add indexes after creating the table.
- Fixed Table Name: Table is named "imported" by default. Rename in the SQL if needed.
- Browser Memory Limits: Very large CSVs (50MB+) may cause slowdowns or crashes.
