<!-- How to Import Excel into a SQL Database -->
<!-- Canonical: https://dataswitchpro.com/guides/import-excel-into-sql/ -->
> Move an Excel sheet into MySQL, PostgreSQL, SQL Server or SQLite: prepare the sheet, choose column types, then load it via CSV, INSERTs or a wizard.

[Home](https://dataswitchpro.com/) › [Guides](https://dataswitchpro.com/guides/)

# How to Import Excel Data into a SQL Database

By the DataSwitch Pro team · November 20, 2026 · 4 min read

## Quick answer

To import Excel into a SQL database, first clean the sheet (one header row, one record per row, no merged cells), create a table with suitable column types, then load the data: save the sheet as CSV UTF-8 and use your database's bulk loader, use SQL Server's Import Wizard, or generate INSERT statements from the .xlsx with an [Excel to SQL converter](https://dataswitchpro.com/excel-to-sql/). Check dates, empty cells and ID columns after loading.

Spreadsheets are where data starts; databases are where it becomes useful to applications. The move is straightforward if the sheet is shaped like a table and the column types are chosen deliberately.

## Step 1: Shape the sheet like a table

- **One header row** with short, unique names. These become column names, so prefer `unit_price` to `Unit price (€)`.
- **One record per row**, with no subtotal rows, blank separator rows or notes beneath the data.
- **No merged cells**. Fill the value into every row instead.
- **One kind of value per column**. A quantity column with “2”, “two” and “n/a” will fail in a numeric column.
- **One table per sheet**. If a workbook has customers and orders, keep them on separate sheets and import each into its own table.

## Step 2: Choose column types

- **Text for identifiers**: SKUs, postcodes, phone numbers, account numbers — anything you never do arithmetic on. This preserves leading zeros and long values.
- **DECIMAL for money**, not FLOAT, to avoid rounding errors (`DECIMAL(12,2)`).
- **DATE or TIMESTAMP for dates**. Excel stores dates as serial numbers; make sure they are exported as `YYYY-MM-DD` text.
- **BOOLEAN** (or `BIT` in SQL Server, `TINYINT(1)` in MySQL) for TRUE/FALSE columns.

## Option A: Generate INSERT statements

1. Open the [Excel to SQL converter](https://dataswitchpro.com/excel-to-sql/) and drop the `.xlsx` file; choose the sheet.
2. Select the dialect — MySQL, PostgreSQL, SQL Server or SQLite — and type the table name.
3. Tick *Add SQL CREATE TABLE* for a starting table definition, and *Empty cells as NULL* if blanks should be NULL.
4. Review the generated types, then run the script in phpMyAdmin, DBeaver, pgAdmin, SSMS or the command line.

This works anywhere you can run SQL, including shared hosting where file-based import is disabled.

## Option B: Save as CSV and bulk load

For large sheets, save as *File → Save As → CSV UTF-8 (Comma delimited)* and use the database's loader — `LOAD DATA`, `\copy`, `BULK INSERT` or `.import`. The exact commands are in [how to import a CSV file into SQL](https://dataswitchpro.com/guides/import-csv-into-sql-database/). Two warnings: Excel exports what each cell *displays*, so a price formatted as “€12” or a date shown as “Nov 20” is exported that way; and some regional settings produce semicolon-separated files. If you need a specific delimiter, export with [Excel to CSV](https://dataswitchpro.com/excel-to-csv/) instead.

## Option C: SQL Server Import and Export Wizard

SQL Server can read `.xlsx` directly: in SSMS, right-click the database and choose *Tasks → Import Data*, then select *Microsoft Excel* as the source. The wizard needs the Microsoft Access Database Engine (ACE) driver, whose 32-bit or 64-bit version must match the wizard you run — a frequent source of “provider is not registered” errors. If that gets in the way, use Option A or B.

## After importing: check these

- **Row count**: `SELECT COUNT(*)` should equal the number of data rows in the sheet.
- **Dates**: look for 1899/1900 dates or five-digit numbers, a sign that serial numbers were imported as values.
- **Text encoding**: search for accented names; “?” or “Ã©” means a character-set problem.
- **Trailing spaces** in text columns, which break joins and lookups. `TRIM` them if needed.
- **NULLs vs empty strings** in optional columns.

## Keeping the sheet and the table in sync

A one-off import is easy; repeated imports of an updated sheet need a key. Give each row a stable ID column, import into a staging table, then use `INSERT ... ON DUPLICATE KEY UPDATE` (MySQL), `INSERT ... ON CONFLICT` (PostgreSQL, SQLite) or `MERGE` (SQL Server) to update existing rows and add new ones. If the data changes often, consider making the database the source of truth and exporting to Excel for viewing — see [exporting SQL results to CSV](https://dataswitchpro.com/guides/export-sql-to-csv/).

**Try it on your own file.** Free, private, and processed in your browser.

[Excel to SQL](https://dataswitchpro.com/excel-to-sql/)[CSV to SQL](https://dataswitchpro.com/csv-to-sql/)[Excel to CSV](https://dataswitchpro.com/excel-to-csv/)[SQL to CSV](https://dataswitchpro.com/sql-to-csv/)

## Frequently asked questions

### Are Excel formulas imported?

No. Only the calculated values are exported; databases store data, not spreadsheet formulas.

### How do I import several sheets?

Import each sheet into its own table. In a converter, choose each sheet in turn; in Python, `pd.read_excel(file, sheet_name=None)` reads all of them.

### Why do my dates import as numbers like 45000?

The cells held Excel serial numbers without a date format. Format the column as Date in Excel, or convert in SQL: serial 45000 is 15 March 2023.

### Can I import .xls (Excel 97-2003) files?

Many tools only read .xlsx. Open the file in Excel or LibreOffice and save it as .xlsx first.

## More guides

- [How to Keep Leading Zeros (and Long Numbers) When Opening CSV in Excel](https://dataswitchpro.com/guides/keep-leading-zeros-csv-excel/)
- [How to Import a CSV File into MySQL, PostgreSQL, SQL Server or SQLite](https://dataswitchpro.com/guides/import-csv-into-sql-database/)
- [Why Your CSV Opens in One Column in Excel (and How to Fix It)](https://dataswitchpro.com/guides/csv-opens-in-one-column-excel/)
- [Fix Garbled Characters (Ã©, â€™, Ã¨) in CSV Files Opened in Excel](https://dataswitchpro.com/guides/fix-garbled-characters-csv-excel/)
