Cette page n’est pas encore traduite en français : elle s’affiche en anglais.

CSV & Excel to SQL Converter

Paste CSV or Excel cells, or open an .xlsx file, and get ready-to-run CREATE TABLE and INSERT statements with correctly escaped values for your database.

Mis à jour le
Open file (.xlsx, .csv, .json)
Input
Dialect
Statements

Input preview

Vos données ne quittent jamais votre ordinateur. Tout le traitement se fait localement dans votre navigateur.

Comment utiliser : CSV & Excel to SQL

  1. Paste CSV or copied Excel cells, open a .csv / .xlsx file, or click Load sample.
  2. Pick your database dialect and enter the table name.
  3. Choose the statements you need: CREATE TABLE with detected types, DROP TABLE, a transaction, and how many rows go in each INSERT.
  4. Check the detected column types in the preview, then Copy or Download .sql and run it in your database client.

What is a CSV to SQL converter?

A CSV to SQL converter turns rows of a spreadsheet into SQL statements a database can execute: a CREATE TABLE statement that defines the columns, and INSERT INTO … VALUES statements that add the data. It is the quickest way to load a one-off export, seed a development database or move data from Excel into MySQL or PostgreSQL without an import wizard.

CREATE TABLE `customers` (
  `id` INT NOT NULL,
  `name` VARCHAR(16),
  `signup_date` DATE,
  `monthly_spend` DECIMAL(10,2),
  PRIMARY KEY (`id`)
);
INSERT INTO `customers` (`id`, `name`, `signup_date`, `monthly_spend`) VALUES
  (1, 'Ada Lovelace', '2024-01-15', 49),
  (4, 'O''Brien, Pat', '2024-04-09', 49);

How column types are detected

Every value in a column is checked and the narrowest type that fits all of them is chosen. The preview shows the result as a badge above each column.

Values in the columnMySQLPostgreSQLSQL Server
Whole numbersINT / BIGINTINTEGER / BIGINTINT / BIGINT
DecimalsDECIMAL(p,s)NUMERIC(p,s)DECIMAL(p,s)
true / falseTINYINT(1)BOOLEANBIT
2024-01-15DATEDATEDATE
2024-01-15 14:30:00DATETIMETIMESTAMPDATETIME2
TextVARCHAR(n) / TEXTVARCHAR(n) / TEXTNVARCHAR(n) / NVARCHAR(MAX)

Text columns get a VARCHAR length rounded up from the longest value (16, 32, 50, 100, 255…). Review the lengths before loading production data — a column that is short in your sample may hold longer values later.

Escaping and dialect differences

  • Quotes inside text are doubled (O'Brien → 'O''Brien'); MySQL output also escapes backslashes.
  • Identifiers are quoted with backticks (MySQL), double quotes (PostgreSQL, SQLite, Oracle) or brackets (SQL Server), so reserved words like order or group work as column names.
  • Multi-row inserts are much faster than one statement per row. SQL Server allows at most 1,000 rows per VALUES list, and Oracle uses INSERT ALL … SELECT 1 FROM DUAL.
  • Empty cells become NULL by default; untick the option to insert empty strings.

Tips for large imports

Wrap the inserts in a transaction so a failed row does not leave half the data behind, and use batches of 500–1,000 rows. For millions of rows, native bulk loaders such as MySQL LOAD DATA INFILE or PostgreSQL COPY are faster still. Have JSON instead? Use JSON to SQL, and design a table by hand with the CREATE TABLE generator. Tidy the result with the SQL Formatter.

Aussi recherché comme : excel to sql, csv to sql insert, csv to mysql, excel to mysql, csv to postgresql, xlsx to sql, insert statement generator, sql insert generator.

Outils complémentaires : CSV & Excel to SQL

  • SQL to JSON, CSV & Excel — Paste a SQL dump or a few INSERT statements and get the rows back as JSON, CSV or an Excel workbook with one sheet per table.
  • Excel to JSON — Open an .xlsx workbook or paste cells straight from Excel or Google Sheets and get clean JSON.
  • CSV to JSON — Paste CSV or TSV and get a JSON array of objects.
  • JSON to Excel — Turn a JSON array into a real Excel workbook.

Questions fréquentes

How do I convert an Excel sheet to SQL INSERT statements?
Open the .xlsx file with Open file (or copy the cells and paste them), choose your database dialect and table name, and copy the generated SQL. The first row is used as column names.
Which databases are supported?
MySQL and MariaDB, PostgreSQL, SQLite, Microsoft SQL Server and Oracle. Each dialect gets its own identifier quoting, string escaping, boolean values and column types.
Can I get one INSERT statement per row?
Yes — set Rows per INSERT to 1. Larger batches (100–1,000 rows per statement) import much faster.
Why are my column names changed?
snake_case column names turns headers such as “Signup Date” into signup_date, which avoids quoting problems. Untick it to keep the original header text.
Is my data uploaded?
No. Parsing and SQL generation run entirely in your browser.
Puis-je installer CSV & Excel to SQL en tant qu’application web et l’utiliser hors ligne ?
Oui. CSV & Excel to SQL est une application web installable (PWA) : elle s’installe depuis votre navigateur, sans passer par une boutique d’applications. Cliquez sur « Installer l’application » en haut de cette page dans Chrome ou Edge (Windows, macOS, Linux, ChromeOS) ; sur Android, utilisez « Partager » → « Ajouter à l’écran d’accueil » sur iPhone et iPad ; ou « Fichier » → « Ajouter au Dock » dans Safari 17+ sur Mac. L’application s’ouvre alors dans sa propre fenêtre avec sa propre icône, et comme elle s’exécute entièrement dans votre navigateur, elle continue de fonctionner hors ligne. Firefox sur ordinateur de bureau ne permet pas d’installer d’applications web. Comment fonctionne l’installation.

Outils similaires