---
title: "Convert Excel to PostgreSQL"
description: "Convert Excel files to SQL for PostgreSQL in your browser: a CREATE TABLE with typed columns, then INSERT statements. Free, and your file is never uploaded."
canonical: https://intosql.com/excel-to-postgresql
last_updated: 2026-10-15
---

# Convert Excel to PostgreSQL

Drop your Excel file to get a PostgreSQL script with CREATE TABLE and INSERT statements. Each column gets a type, and every fix is listed with its row and column.

## From Excel to PostgreSQL, column by column

The sample above, clientes_2024.xlsx, as IntoSQL writes it for PostgreSQL: what each column holds in the file, the type it gets and how its first value lands in the script.

| In the file | First value | Column | PostgreSQL type | In the script |
| --- | --- | --- | --- | --- |
| Nº Cliente | `00127` | `no_cliente` | `text` | `'00127'` |
| Nombre | `Peña Muñoz` | `nombre` | `text` | `'Peña Muñoz'` |
| C.P. | `01234` | `c_p` | `text` | `'01234'` |
| Alta | `03/02/2024` | `alta` | `date` | `'2024-02-03'` |
| Activo | `sí` | `activo` | `boolean` | `TRUE` |
| Saldo | `1.234,50` | `saldo` | `numeric(6,2)` | `1234.50` |

## Load the script into PostgreSQL

The download is a plain .sql file. Run it with PostgreSQL's own tools.

### PostgreSQL

```shell
psql -v ON_ERROR_STOP=1 -d mydb -f clientes_2024.postgresql.sql
```

ON_ERROR_STOP makes psql stop at the first error. The script runs in one transaction, so a failed load leaves the database as it was. In pgAdmin or DBeaver, open the script in a query window and run it.

Without a script:

```shell
intosql load clientes_2024.xlsx --into postgres://user@localhost/mydb
```

## What IntoSQL reads in Excel files

- The header row is found even when titles or notes sit above it, and a totals row at the end is left out.
- Dates stored as Excel serial numbers become real dates, in both the 1900 and the 1904 date systems.
- Codes with leading zeros, like 00127, stay text. When a workbook has several sheets, you pick the sheet.

## What to know about PostgreSQL

- Decimals keep their exact digits as numeric(p,s), and dates with an offset become timestamptz.
- PostgreSQL text can't hold the NUL character, so it is removed from the values that have one.
- The script runs in one transaction, so a load that fails leaves nothing half done.

### How each kind of value is stored in PostgreSQL

| Value | PostgreSQL |
| --- | --- |
| Yes and no | `boolean` |
| Whole numbers | `integer` |
| Large whole numbers | `bigint` |
| Decimals | `numeric(p,s)` |
| Floating-point numbers | `double precision` |
| Dates | `date` |
| Times of day | `time` |
| Dates with a time | `timestamp` |
| Dates with a time and offset | `timestamptz` |
| Text | `text` |

## Questions about Excel to PostgreSQL

### How do I convert Excel to PostgreSQL?

Drop your file on the converter at the top of this page. It finds the header, reads every value and writes the PostgreSQL script, listing each fix it made. Download the script and run it with psql.

### Which sheet of the workbook is converted?

The first visible sheet. When a workbook has more than one, a Sheet option appears, so you can pick another.

### Which PostgreSQL types does it use?

Yes and no values become boolean, whole numbers integer, decimals numeric(p,s), dates date, dates with a time timestamp and text text. Sizes come from the longest value in each column.

### Does it keep leading zeros in PostgreSQL?

Yes. A code such as 00127 stays text, so PostgreSQL stores it as text and the script writes it as '00127'.

### Can it load the data into PostgreSQL without a script?

Yes, with IntoSQL Pro. The desktop app and the command line connect to PostgreSQL and load the rows straight in, creating the table first.

### How big can the Excel file be?

In the browser, a workbook is read whole, so the limit is the memory the browser gives this page. The desktop app and the command line take workbooks of any size; on an Apple M4 laptop the command line converts a 117 MB workbook of a million rows in about a second.

## Excel into other databases

- [Convert Excel to SQL](https://intosql.com/excel-to-sql)
- [Convert Excel to MySQL](https://intosql.com/excel-to-mysql)
- [Convert Excel to MariaDB](https://intosql.com/excel-to-mariadb)
- [Convert Excel to SQLite](https://intosql.com/excel-to-sqlite)
- [Convert Excel to SQL Server](https://intosql.com/excel-to-sql-server)
- [Convert Excel to Oracle](https://intosql.com/excel-to-oracle)

## Other files into PostgreSQL

- [Convert CSV to PostgreSQL](https://intosql.com/csv-to-postgresql)
- [Convert JSON to PostgreSQL](https://intosql.com/json-to-postgresql)
