Import each sheet in an Excel file to a separate PostgreSQL table

by

Want to import data from each sheet in an Excel file to a separate PostgreSQL table?

Try Withdata FileToDB, a desktop Excel to PostgreSQL converter for Windows, MacOS, and Linux, Convert Excel to PostgreSQL, Easy and Fast.

Download Withdata FileToDB Download FileToDB

Import data from each sheet in an Excel file to a separate PostgreSQL table

Login to PostgreSQL -> Select Excel worksheets -> Set PostgreSQL tables -> Excel worksheets to PostgreSQL tables

Choose PostgreSQL and logon.

import data from each sheet in an Excel file to a separate PostgreSQL table - Choose PostgreSQL and logon

Click “Wizard – 1 File To N Tables” at task dialog.

import data from each sheet in an Excel file to a separate PostgreSQL table - task window

Select the “Excel” file type.

load each sheet in an Excel file to a separate PostgreSQL table - select file type

then show the wizard.

1. Open Excel file, select worksheets.

import data from each sheet in an Excel file to a separate PostgreSQL table - select worksheets

2. Show existing PostgreSQL tables, choose “Import Type”.

import data from each sheet in an Excel file to a separate PostgreSQL table - choose import type

3. Set PostgreSQL tables.

import data from each sheet in an Excel file to a separate PostgreSQL table - set tables

4. Show summary, set “Convert Rows”.

import data from each sheet in an Excel file to a separate PostgreSQL table - summary

5. Import data from each sheet in an Excel file to a separate PostgreSQL table.

import data from each sheet in an Excel file to a separate PostgreSQL table - import data

View imported data in PostgreSQL table

import data from each sheet in an Excel file to a separate PostgreSQL table - view data


More about Excel to PostgreSQL converter

See Video: Import each worksheet in an Excel file to a separate PostgreSQL table at one time

EXCEL → PostgreSQL reference

Type mapping

Value kindin EXCELin PostgreSQL
Int1234 (a real numeric cell)integer
Bigint9007199254740993 (exact only while the cell stays text)bigint
Decimal1234.56 (numeric cell, format controls the displayed decimals)numeric(p,s)
Float1.234E+10 (numeric cell)double precision
Texttext cell; leading zeros survive only if the column is textvarchar(n)
Long texttext cell; wraps inside the cell rather than the rowtext
Datea serial number plus a date cell formatdate
Datetimea serial number plus a date-time cell formattimestamp
Binarynot representable as databytea
BooleanTRUE / FALSE (a real boolean cell)boolean
JSONa text cell; the quotes are part of the valuejsonb

Dialect differences

EXCEL is a file format and PostgreSQL is a database server, so the target has to be told the types the file never carried - the rows below are where the two sides diverge.

Propertyin EXCELin PostgreSQL
port—5432
identifiersNot applicable; a cell holds exactly one value"double quotes"
row limit—LIMIT n
datesStored as a serial number; only the cell format makes it lo...timestamp, timestamptz, date, time
long text—TEXT
binaryOnly as text or an embedded object, not as a data columnBYTEA
separatorCells, not delimiters—
encodingUTF-8 internally, declared in the package—
typingReal cell types: text, number, date, boolean, error—
shapeMultiple sheets, each a flat gridTables of rows and columns
ceiling1,048,576 rows x 16,384 columns per sheet; 255 sheets per w...—

Command line

SideCommand
PostgreSQLpg_dump or COPY ... TO
PostgreSQL (load)COPY ... FROM

Convert your data online, free

Free in-browser converters for CSV, Excel, JSON, XML and SQL: Withdata Online Data Conversion. Large files, batch conversion or scheduling? See the offline desktop apps, or browse all data conversion tools.