Skip to main content

Convert files without leaving your AI agent - Claude Code, Cursor, Gemini & more. Set up your agent

1 / 4
Back to Blog
03.09.2026

Convert Excel and CSV to SQL (MySQL, PostgreSQL, SQL Server, SQLite)

Upload a spreadsheet, pick your database, and download a SQL script that creates the table and inserts the rows - with column types read from the data and every sheet as its own table.

Getting a spreadsheet into a database is one of those jobs that sounds like it should take a minute and somehow eats an afternoon. You click through an import wizard, it guesses the column types wrong, your order numbers arrive as 1.0 instead of 1, a stray apostrophe in a customer name breaks the whole load, and you end up writing a small script just to get a file into a table.

We have added five converters that skip all of that. You upload the file, pick your database, and get back a plain .sql script that creates the table and inserts the rows - ready to run.

How it works

  1. Open the Excel to SQL converter (or whichever format you have).
  2. Upload your file and choose your target database.
  3. Download the .sql file and run it in your database client.

That is it. No install, no connection string, nothing to configure. The script is a normal text file, so you can read it, edit it, commit it, or hand it to whoever administers the database.

Four databases, each done properly

Pick MySQL / MariaDB, PostgreSQL, Microsoft SQL Server or SQLite, and the script is written for that database specifically - the right way of quoting names, the right column types, the right way of writing out values.

This is the part that usually goes wrong with generic "export to SQL" tools. Each database quotes identifiers differently, disagrees about what a boolean or a timestamp is, and has its own rules about characters inside text. A script that works in MySQL can fail on the third row in SQL Server. Every script we generate has been tested by actually loading it into the real database and reading the data back out again, character by character, to confirm it survives the trip intact - apostrophes, quotes, backslashes, tabs, line breaks, accents, and non-Latin scripts included.

A multi-sheet workbook becomes a set of tables

This is the one that saves the most time. If your workbook has an Orders sheet, a StockItems sheet and a Suppliers sheet, you do not get one flattened mess - you get three tables, named after the sheets, in one script:

CREATE TABLE [Orders] (
  [OrderID] INT,
  [StockItemID] INT,
  [Quantity] INT,
  [OrderDate] DATE
);

INSERT INTO [Orders] ([OrderID], [StockItemID], [Quantity], [OrderDate]) VALUES
  (1, 1, 10, '2026-08-02'),
  (2, 2, 5, '2026-08-03');

Run it once and the whole workbook lands in your database as a small schema you can immediately join against, rather than three separate imports you have to stitch together by hand.

Column types that match your data

The columns are typed from the data itself, not guessed from the first row:

  • Whole numbers become integer columns. Spreadsheets have no integer type - internally every number in Excel is a decimal - so most tools declare your ID column as a floating point number and you end up with 1.0 as a primary key. We check whether a column holds nothing but whole numbers and declare it INT or BIGINT accordingly.
  • Decimals stay decimals. A price column of 75.50 and 0.25 stays a floating point column, because it genuinely is one.
  • Dates stay dates, rather than turning into the raw serial numbers Excel stores underneath.
  • Text columns are sized to the longest value found, so you get an indexable VARCHAR(32) instead of a blanket TEXT blob. Anything genuinely long falls back to a large text type.
  • Empty cells become NULL, not empty strings. The difference matters once you start querying.

It will not wipe your table

The generated script never contains DROP, TRUNCATE or DELETE. Importing a file should not be able to destroy data you already have, and plenty of import recipes floating around online do exactly that by opening with a DROP TABLE.

If the table already exists and you only want the rows, switch Include CREATE TABLE statement off and you will get just the INSERT statements. And if you would rather the table were called something other than your sheet name, set Table name.

Old .xls files work too

Legacy binary .xls workbooks are handled as well as modern .xlsx. Plenty of tools quietly dropped support for the old format, which is awkward when the file you have been handed was exported by a system from 2009 and nobody is going to re-export it for you.

Automate it

Every one of these converters is available through the API, so a recurring import can run on a schedule rather than through the browser: drop the file, get the script, load it. It is also available through Zapier and the command line if that fits your workflow better.

Frequently asked questions

Which databases are supported? MySQL (and MariaDB), PostgreSQL, Microsoft SQL Server and SQLite. Each gets a script written for its own rules.

Does it create the table for me? Yes, by default, with column types read from your data. You can turn that off if the table already exists.

What happens to a workbook with several sheets? Each sheet becomes its own table, named after the sheet.

Will it overwrite my existing table? No. The script only creates a table and inserts rows. It never drops or deletes anything.

How do I run the file? Open it in your usual database client and execute it, or use the command line - mysql mydb < import.sql, psql -d mydb -f import.sql, or open it in SQL Server Management Studio and press Execute.

Is my data kept private? Files are encrypted in transit, your upload is deleted within minutes after a successful conversion, and results after 2 hours (24 hours for long conversions and API conversions). They are never shared.

Related articles

Share this article with your friends or colleagues!