infile
Local File
or URL
Or Data
string
This is the input file: raw data, or URL. Choose one of the options of "Local File", "URL", or "Data"
curl -X POST "https://www.convertcsv.io/api/v1/csv2json/" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
tablename
string
SQL table name
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?tablename=invoice_detail" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
aftercreate
string
CREATE TABLE {insert text here} ...
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?aftercreate=if+not+exists" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
afterdrop
string
DROP TABLE {insert text here} ...
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?afterdrop=if+exists" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
afterinsert
string
INSERT {insert text here} INTO ... Also works with the SQL REPLACEstatement.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?afterinsert=OR+REPLACE" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
batch
integer
Group N statements together
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?batch=1000" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
createtable
boolean
Generate CREATE TABLE command
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?createtable=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
delete
boolean
Generate DELETE statements
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?delete=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
delimiter
string
Input file delimiter, default is automatic detection. You usually will not need to use this.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?delimiter=%5E" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
droptable
boolean
Generate DROP TABLE command - use this with caution. DROP TABLE will be generated before CREATE TABLE.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?droptable=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
dual
string
Name of DUAL table, i.e. dual. Some databases do not require a DUAL table, but others like Oracle do.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?dual=dual" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
encoding
string
File encoding - if not passed, the converter will attempt to determine the encoding by looking at the first few thousand bytes of the file. Typical values are: utf-8, utf-16.
You can see a list of all supported types here: https://docs.python.org/3/library/codecs.html
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?encoding=ascii" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
escape
boolean
Escape special characters with backslash for SQL strings. Use this mode if generating SQL for MySQL like databases.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?escape=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
exclude
string
Exclude these fields in conversion. Use this if you want to convert all fields except these.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?exclude=5" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
exnulls
string
Do not output NULL for NULL in these fields. Many CSV files have NULL for NULL fields in a database table. The default is to convert those to NULL in SQL for instance, or null in JSON, however, NULL can be a legitimate value. Use this option to exclude fields from the default conversion.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?exnulls=5" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
fields
string
Include these fields in conversion. You specify fields by their position, starting at 1. If you wanted the first 5 fields, you can type 1,2,3,4,5 or 1-5. The default is to include all fields.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?fields=1,2,3" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
headover
string
List of header columns - Use this to override the headers on the CSV file. If the input has no headers (as specified by parameter noheader), then this parameter is a way to specify the headers.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?headover=pk,fullname,amount,comment" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
increment
string
If you identify a single numeric primary key, use this to add an increment phrase. Use phrases like: IDENTITY or AUTO_INCREMENT, etc.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?increment=IDENTITY" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
index
string
Columns to create index on, i.e. 3,4. If generating SQL statements, this will generate a "CREATE INDEX" SQL statement.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?index=3,4" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
insert
boolean
Generate INSERT statements
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?insert=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
key
string
Identify the primary key by column position (starting with 1)
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?key=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
limit
integer
Limit number of output records to N, i.e. 100. If you have a large output file, use this option to limit your output.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?limit=10" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
lower
string
Output lower case for these fields
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?lower=6" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
merge
boolean
Generate MERGE statements
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?merge=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
noheader
boolean
Input CSV file has no column headings
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?noheader=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
nulls
string
Convert 'NULL' to a NULL SQL value or null JSON value. Many popular tools export the string NULL in place of NULL values in tables. By default, the converter will convert ALL NULL values to a NULL SQL value or null JSON value. If you use this option, only the fields specified will be converted. See also exnulls.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?nulls=1,5,6" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
replace
boolean
Generate REPLACE SQL statements. Only a few databases support REPLACE, but most support INSERT OR REPLACE.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?replace=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
required
string
These fields are required, i.e. 5-10. For SQL, this generates a NOT NULL clause in the CREATE TABLE statement.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql/" -F "infile=@[YOUR FILE]" -F "required=1-10" -H "Authorization: Token [YOUR TOKEN]"
sample
integer
Sample N record from input file. Default is the whole file. The purpose of sample is to determine the structure and data types of the input file.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?sample=100" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
select
boolean
Generate SELECT SQL statements
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?select=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
skiplines
integer
Skip/Ignore N record at top of input file. You may have a CSV file with empty lines or extra verbiage at the top. Use this option to skip those lines.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?skiplines=2" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
tab
boolean
TAB is the CSV file delimiter
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?tab=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
trim
string
Trim leading and trailing spaces for these fields. Use column positions to identify the fields. For instance if you always want fields 4 and 5 without leading and trailing spaces, then use this option.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?trim=4,5" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
unicode
boolean
Unicode Literal support in CSV to SQL. Off by default. Turn on to detect and generate NVARCHAR, NCHAR columns and N prefixed string literals, i.e. N'Welcome'
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?unicode=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
update
boolean
Generate UPDATE SQL statements
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?update=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
upper
string
Output upper case for these fields
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql=4,5" -F "infile=@[YOUR FILE]" -F "upper=1-4" -H "Authorization: Token [YOUR TOKEN]"
wrap
string
Wrap SQL identifier in this character. To wrap in square brackets like SQL Server does, use [ or %5B as a query parameter. The ANSI standard is double quote " and it is used by default. The wrap character is only used when the identifier is not valid without it. You can always wrap identifiers by passing the beginning and ending character. For ANSI: "" (2 double quotes), for SQL Server: [], for MySQL - ``.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?wrap=%5B" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
xin
boolean
Input file is an Excel file with either .xlsx or .xls extension. If your column headers do not start on line 1, then use the "skiplines" option to skip to the header or data.
curl -X POST "https://www.convertcsv.io/api/v1/csv2sql?xin=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"