Conversor de CSV a SQL
Convierte datos de hoja de cálculo en SQL ejecutable. Pega un archivo CSV y obtén sentencias CREATE TABLE más INSERT, con tipos de columna inferidos de los valores y soporte para los dialectos MySQL, PostgreSQL, SQLite y SQL Server.
The reverse direction is the SQL to CSV Converter, and the table definition itself comes from the JSON Schema Generator approach. To load the data as JSON instead, the CSV to JSON Converter is the alternative.
Cómo usar CSV a SQL
- 1 Paste your CSV, or load a file.
- 2 Set the table name and the column names.
- 3 Choose the target dialect so quoting and types are correct.
- 4 Copy the generated insert statements.
Cómo usarlo
Pega texto CSV (o suelta un archivo) y la conversión se ejecuta al instante. La primera fila se trata como cabecera salvo que lo desactives. Los tipos de columna se infieren de los datos (enteros, decimales, booleanos, fechas o texto) y el entrecomillado de identificadores sigue el dialecto que elijas.
- Detección automática de delimitador (coma, punto y coma, tab)
- Campos entrecomillados y comillas escapadas manejadas correctamente
- Inferencia de tipo de columna por columna
- Salida CREATE TABLE e INSERT multi-fila
- Dialectos MySQL, PostgreSQL, SQLite y SQL Server
Notas de seguridad
Los valores de cadena se escapan duplicando las comillas simples, que es el escape SQL estándar. Esto está bien para generar scripts de migración y fixtures. Para consultas en tiempo de ejecución que mezclen entrada de usuario, prefiere siempre sentencias parametrizadas en el código de tu aplicación en lugar de construir SQL a mano.
Preguntas frecuentes
How should values be typed?
By matching the destination column. A CSV has no types, so the converter has to guess or be told. Quoting a numeric column makes the value a string, which some engines will coerce and others will reject. Reading the table schema first and declaring the types is the reliable approach.
What is the fastest way to insert many rows?
By batching several rows into a single insert statement rather than emitting one statement per row. The overhead is per statement rather than per row, so a multi-row insert is dramatically faster on any real volume. There is a limit on statement size, which is why the batching is usually configurable.
How do I handle values that are NULL?
By deciding what an empty cell means. In CSV an empty field is genuinely ambiguous: it could be an empty string, a null, or a missing value. The SQL keywords for null is unquoted, whereas an empty string is quoted, so the converter's setting for this determines the semantics of the imported data.
Herramientas para desarrolladores relacionadas
También te puede interesar
Herramientas de otras categorías que suelen combinarse con CSV a SQL: