Skip to content

Csv To Sql API

POST https://api.findutils.com/api/tools/csv-to-sql/execute

Convert CSV text into SQL INSERT statements, optionally preceded by a CREATE TABLE. The first row is the header and becomes the column list. Column types are inferred from the first 50 data rows as integer, numeric, boolean, or text, and identifiers are quoted for the chosen dialect (Postgres, MySQL, or SQLite). Empty cells become NULL by default. Nothing is executed against a database.

Request body

application/json
  • csv

    string required

    CSV text with a header row.

  • table

    string optional

    Target table name. Default: "my_table". Default "my_table".

  • dialect

    string optional

    Identifier quoting and type names. Default: postgres. One of postgres · mysql · sqlite. Default "postgres".

  • create_table

    boolean optional

    Emit a CREATE TABLE before the inserts. Default: true. Default true.

  • null_empty

    boolean optional

    Write an empty cell as NULL rather than an empty string. Default: true. Default true.

  • batch

    boolean optional

    Emit one multi-row INSERT instead of one statement per row. Default: false. Default false.

Example arguments

Verified
{
  "csv": "id,name\n1,Ada\n2,\"Doe, John\"",
  "table": "people",
  "dialect": "postgres"
}