CSV CleanerText Tools
Cleans CSV data by trimming cells, removing empty rows, deduping rows, and fixing delimiter issues.
A spreadsheet export needs to become a MySQL table. Clean the file before you load it, then let the column types come from the data.
Spreadsheet exports carry problems you don't see in Excel: spaces around values, empty rows at the end, duplicate rows, semicolons where MySQL expects commas, and rows with fewer cells than the header. A value with an apostrophe, such as O'Neil, breaks a hand-written INSERT unless the quote is escaped.
Column types cause the rest. Load a price column as text and every sum needs a cast. Declare an ID column as INTEGER and a value over 2,147,483,647 needs BIGINT instead. Fixing these after the import means altering a table that may already hold bad data.
Paste the CSV or upload the file in the CSV Cleaner. It parses the data as CSV, so quoted fields with commas or line breaks inside stay intact. Turn on Trim cells, Remove empty rows, and Remove duplicate rows, and set the output delimiter to comma. Fill ragged rows pads short rows so every row has the header's width. Duplicate detection compares whole rows, not one chosen column.
Then open the CSV to SQL Converter, pick MySQL, and type the table name. It infers each column's type from all of its values. Whole numbers become INTEGER, or BIGINT above 2,147,483,647. Decimals become DECIMAL, true and false become BOOLEAN, YYYY-MM-DD dates become DATE, and anything else becomes VARCHAR sized to the longest value. It writes a CREATE TABLE and INSERT statements with backticks around names, and it doubles single quotes inside values, so O'Neil goes in as 'O''Neil'. It takes files up to 5 MB and runs in your browser.
For hundreds of thousands of rows, MySQL's bulk loader, LOAD DATA INFILE, is much faster and reads the CSV directly. Clean the file first either way.
mysql -u user -p dbname < import.sql.Upload the CSV to the CSV to SQL Converter, choose MySQL and a table name, and copy the CREATE TABLE and INSERT statements.
A single quote inside a value is doubled, so O'Neil becomes 'O''Neil', the standard SQL escape.
Use LOAD DATA INFILE. It reads the CSV directly and is much faster than INSERT statements for hundreds of thousands of rows.
No. The CSV to SQL Converter runs in your browser, and the SQL is text you copy or download.
Tools used in this guide
Cleans CSV data by trimming cells, removing empty rows, deduping rows, and fixing delimiter issues.
CSV to CREATE TABLE and INSERT statements.