Skip to content

TSV to SQL Converter

Convert TSV (Tab-Separated Values) data into SQL INSERT statements with automatic table creation, type detection, and multiple insert formats

Category: data
Use Case: Database Migration, Data Import, SQL Testing
Privacy: 100% browser-based

SQL Options

Recommended Settings

Pro Tips

  • Column types are auto-detected from the TSV's cell values: numbers, booleans, and text
  • The first row is always treated as column headers and sanitized into valid SQL identifiers
  • Single INSERT format is most efficient for bulk imports in most databases
  • Batch INSERT splits data into manageable chunks for large datasets
  • Enable unescaping if your TSV has literal \t, \n, or \r sequences that should become real characters

Most Popular

Most users enable CREATE TABLE with the Single INSERT format for complete database-ready SQL

When to Use This Tool

Database Migration

Convert TSV data exports into SQL INSERT statements for migrating data between databases, systems, or environments. The CREATE TABLE option generates a ready-to-run schema.

Data Import & Seeding

Transform TSV files into SQL for importing data into MySQL, PostgreSQL, SQLite, or other SQL databases. Perfect for seeding test databases or loading sample data.

SQL Testing & Development

Create test data sets from TSV exports for SQL query testing, stored procedure development, and database performance testing.

Command-Line Data Pipelines

Convert TSV output from Unix tools like awk or cut into SQL statements for loading into a relational database.

How It Works

1

Split the TSV input into rows on newlines, and each row into cells on tab characters

2

Optionally unescape literal \t, \n, and \r sequences back into real characters

3

Sanitize the header row into valid SQL column names (lowercase, underscores, no special characters)

4

Infer each column's type from its values (INT, DECIMAL, BOOLEAN, or VARCHAR/TEXT) and generate a CREATE TABLE statement if enabled

5

Format values based on type (escape strings, convert booleans, handle NULLs) and generate INSERT statements in the selected format

100% Private

Files never leave your device. All processing happens locally in your browser.

Lightning Fast

Powered by Pure JavaScript for optimal performance on modern browsers.

Secure

No data collection, no tracking, no sign-up required.

Frequently Asked Questions

What TSV format does this tool expect?

Standard tab-delimited data: rows separated by newlines, columns separated by tab characters, with the first row treated as column headers.

How does automatic type detection work?

Each column's values are checked across all rows. If every value is a whole number, the column becomes INT; if all decimal, DECIMAL(10,2); if all true/false, BOOLEAN; if any value is long text, TEXT; otherwise VARCHAR(255).

What's the difference between the INSERT formats?

Single INSERT creates one statement with multiple VALUES rows - most efficient for bulk imports. Multiple INSERT creates a separate statement per row - easier to debug. Batched INSERT splits rows into chunks, useful for very large datasets.

How are column names sanitized?

Column names are converted to lowercase, spaces and special characters are replaced with underscores, multiple underscores are collapsed to one, and leading/trailing underscores are removed.

What happens to empty cells?

Empty cells are converted to NULL in the SQL output, the standard way to represent missing data. Make sure your table schema allows NULLs for those columns.