Table Editor

SQL Table Generator

Fill in the grid and copy one SQL INSERT statement per row into your database console or a migration script.

How to create your table

  1. Put the column names in the first row. Turn on Headers › Header row so the first row becomes the header.
  2. Type or paste the data rows below it.
  3. Choose your database under Database in the output panel menu (⋮): Standard (PostgreSQL, SQLite), MySQL / MariaDB, SQL Server or Oracle.
  4. Copy the statements and replace table_name with the name of your table.

Example output

INSERT INTO table_name (item, qty, price) VALUES ('Widget', '4', '3.00');
INSERT INTO table_name (item, qty, price) VALUES ('Gadget', '12', '5.50');

What an INSERT statement contains

INSERT INTO table_name (item, qty) VALUES ('Widget', '4'); names the table, lists the columns, and gives one value per column in the same order.

The generator takes the column names from the header row and writes one statement per data row. The table name is always table_name; replace it with the name of your table after you copy. The table must already exist, so run your CREATE TABLE statement first.

Databases

Choose Database in the output panel menu (⋮). Standard is for PostgreSQL and SQLite. MySQL / MariaDB also escapes backslashes and line breaks with a backslash. SQL Server writes strings as N'...', so characters outside the database's code page are kept. Oracle writes line breaks and & as CHR(10) and CHR(38), because SQL*Plus and SQL Developer read &name as a substitution variable.

The output of each setting is tested by running it in the database and reading the rows back: PostgreSQL, SQLite, MySQL 8.4, MariaDB 11.4, SQL Server 2022 and Oracle 23.

One INSERT per row

Each data row gets its own INSERT statement. The generator does not write a multi-row INSERT ... VALUES (...), (...). With Pretty print off (View › Output), the statements are written on one line, separated by spaces.

Types, strings and NULL

Every value is written as a quoted string, numbers included: '4'. Checkbox cells are the exception: TRUE or FALSE (1 or 0 in SQL Server). A single quote inside a value is written twice, as in 'O''Brien'. Number formats are not applied, so a cell that shows $1,234.50 because of its currency format is written as the number you typed.

An empty cell is written as an empty string (''), not as NULL, except in Oracle, which stores '' as NULL. If a column should hold NULL for empty cells, change those values after you copy.

What the editor can do

  • Merge and split cells
  • Paste cells from Excel, Google Sheets or an HTML table
  • Import CSV, TSV, Excel (.xlsx), OpenDocument (.ods), Markdown, HTML, LaTeX, Typst, JSON, MediaWiki and plain text tables
  • Copy the table as one of 14 text formats, or download it as an Excel, OpenDocument or Word (.docx) file
  • Header rows and columns, borders, and bold, italic and alignment per cell
  • Number formats for numbers, percentages and currencies
  • Checkboxes, and one link per cell. Links stay links in Markdown, HTML, LaTeX, Typst, Excel, Word and the other formats that have them
  • Sort, transpose, fill down or right, and find and replace with regular expressions
  • Undo and redo, keyboard shortcuts and a command palette (Alt+Q)
  • Save tables in the browser, reopen recent tables and share a table as a link
  • Also available as a Windows app

Table Editor for Windows

The same editor as a Windows app, with what a browser tab can't do.

  • Tabs. Keep several tables open at once. Tabs with unsaved changes come back when you start the app again.
  • Your own files. Open Excel, CSV, Markdown, LaTeX and other files directly, also from Windows Explorer, and save back to the same file.
  • Offline, without ads. Works without an internet connection. No ads, no analytics, and nothing leaves your computer.

A one-time purchase in the Microsoft Store.

Get it from MicrosoftGet it from Microsoft

Frequently asked questions

Can I convert a CSV file into SQL INSERT statements?
Yes. Open the .csv file with File › Import, or paste the CSV text there. Use Row › Set first row as header so the column names come from the file, choose your database under Database in the output panel menu (⋮), and copy the statements. Replace table_name with the name of your table.
What does the generator create?
One INSERT INTO table_name (...) VALUES (...); statement per data row. It does not create the table, so run your CREATE TABLE statement first.
How are the column names made?
Header cells are lowercased, and characters other than letters, digits and underscores become _. A name that starts with a digit gets a col_ prefix, and a reserved word such as order or select gets _ added. The Database setting adds the reserved words of SQL Server or Oracle, shortens names to the length MySQL (64), SQL Server or Oracle (128) accepts, and gives Oracle names that start with _ a col_ prefix. Without a header row, the columns are named column1, column2 and so on.
How are values quoted?
Every value is written as a string in single quotes, and a single quote inside a value is written twice (''). For MySQL / MariaDB, backslashes and line breaks are also escaped (\\, \n), which assumes the default SQL mode (without NO_BACKSLASH_ESCAPES). For SQL Server, strings are written as N'...' and line breaks as NCHAR(10). For Oracle, line breaks and & are written as CHR(10) and CHR(38), and an empty cell is stored as NULL, because Oracle treats '' as NULL. The databases convert quoted numbers to the column's type when they insert them. A checkbox cell is written as TRUE or FALSE, and as 1 or 0 for SQL Server, which has no boolean literal. Oracle reads TRUE and FALSE from version 23ai; for older versions, change them to 1 and 0.

Sources and further reading

About Table Editor · Changelog

Loading the editor…