CSV to SQL Converter
Drop a CSV and get CREATE TABLE and INSERT statements at once, ready to copy or download as .sql.
Processed on your device. Nothing is uploadedHow to check
You can also paste CSV or JSON text with Ctrl+V (⌘+V on a Mac).
Paste text instead
Pasted text stays in this tab and is never sent anywhere.
Load a CSV export into a database without writing the statements by hand. Choose, drop or paste a CSV or TSV file and the SQL appears at once: a CREATE TABLE with one column per header, then one INSERT per row. The delimiter and encoding (UTF-8, UTF-16 with a byte order mark, Windows-1256 Arabic or Windows-1252) are detected for you. The table name comes from the file name and you can change it. Identifiers are in double quotes, as standard SQL writes them, so the script runs in PostgreSQL as it is. Copy the result or download it as a .sql file; the file is read in your browser and never uploaded.
Why use CSV to SQL
Private
Your CSV is read and turned into SQL by your own browser and never sent to a server, so customer exports stay on your device.
Typed columns
A column whose filled cells are all numbers becomes REAL with unquoted values; everything else is text with quotes escaped.
Works offline
Once this page has loaded, it keeps working without an internet connection.
How it works: convert CSV to SQL
Add your CSV
Choose or drop a .csv or .tsv file, paste CSV text into the box, or try a sample. The delimiter and encoding are detected for you.
Name the table
The table name starts from the file name; type another one and the SQL updates.
Copy or download
Copy the whole script to your clipboard or download it as a .sql file, then run it in your database.
What the CSV to SQL converter handles
- Files: .csv and .tsv, or CSV text you paste; comma, semicolon, tab and pipe delimiters.
- Encodings: UTF-8, UTF-16 (when the file starts with a byte order mark), Windows-1256 Arabic and Windows-1252 Western European text, detected automatically.
- Output: one CREATE TABLE with a column per header, then one INSERT per row.
- Types: all-number columns become REAL with unquoted values, and an empty number becomes NULL.
- Text: wrapped in single quotes, with any ' inside doubled, so names like O'Brien load safely.
- Quoted CSV fields with commas or line breaks inside, as Excel and Google Sheets write them.
CSV to SQL: what it can't do
- Identifiers use double quotes (standard SQL). MySQL reads them only with ANSI_QUOTES on; otherwise replace them with backticks.
- Only two types are written, REAL and TEXT: dates, booleans and keys are left for you to set after import.
- The preview shows the first 5,000 lines; Copy and Download always take the whole script.
CSV to SQL: questions and answers
- Is my file uploaded?
- No. Your browser reads the CSV and writes the SQL on your device. Pasted text stays in this tab and is never sent anywhere, and nothing is saved on the site.
- Which databases can run the script?
- PostgreSQL runs it as it is, because identifiers are in standard double quotes. MySQL and MariaDB need the ANSI_QUOTES SQL mode, or you can replace the double quotes with backticks.
- How are column types chosen?
- A column becomes REAL when every filled cell in it is a number; its values are written without quotes and an empty cell becomes NULL. Any other column is TEXT.
- Are apostrophes and quotes in my data safe?
- Yes. Text values are wrapped in single quotes and any single quote inside is doubled, so O'Brien is written as 'O''Brien' and the statement stays valid.
- Where does the table name come from?
- From the CSV file's name. Type another name in the table name field and the CREATE TABLE and every INSERT update at once.
- Is there a size limit?
- There is no fixed limit, but very large files can take a few seconds and are limited by your device's memory. The preview shows the first 5,000 lines; Copy and Download take everything.
- How do I convert a CSV file to SQL INSERT statements?
- Open or paste the CSV, check the table name, then copy the CREATE TABLE and INSERT script or download it as a .sql file to run in your database. OpenAnyDoc writes the SQL in your browser, so the data is never uploaded.
Why it's private: your files never leave your browser
Most online viewers upload your file to a server, so a copy of it leaves your device. OpenAnyDoc works the other way round: your browser reads the file and draws it on your screen. Nothing is uploaded, there is no account, and the file is gone from memory when you close the tab, so there is nothing for us to store, see or lose.
How we tell you about new features
Announcements are based on the release date shown to everyone, and nothing is stored on your device or sent anywhere.