Import an Excel table to a Postgresql one

Started by Daniele Beauquierover 21 years ago5 messagesgeneral
Jump to latest
#1Daniele Beauquier
beauquier@univ-paris12.fr

How to import an Excel table into a Postgresql table in a simple way?

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Daniele Beauquier (#1)
Re: Import an Excel table to a Postgresql one

Daniele Beauquier wrote:

How to import an Excel table into a Postgresql table in a simple way?

Export into a text file and import using COPY.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

#3Bruno Wolff III
bruno@wolff.to
In reply to: Daniele Beauquier (#1)
Re: Import an Excel table to a Postgresql one

On Fri, Sep 17, 2004 at 18:50:53 +0200,
Daniele Beauquier <beauquier@univ-paris12.fr> wrote:

How to import an Excel table into a Postgresql table in a simple way?

Export it into CSV or TSV format and then use \copy in psql to load it.

#4Mike Nolan
nolan@gw.tssi.com
In reply to: Bruno Wolff III (#3)
Re: Import an Excel table to a Postgresql one

How to import an Excel table into a Postgresql table in a simple way?

Another way is to save the Excel table as a dBase file and import it
using the dbf2pg utility in the contrib/dbase directory.
--
Mike Nolan

#5Dann Corbit
DCorbit@connx.com
In reply to: Mike Nolan (#4)
Re: Import an Excel table to a Postgresql one

Yet another alternative:

Create an ODBC, OLEDB or JDBC connection to PostgreSQL and Excel.
Create a target table in the PostgreSQL table with the attributes that
you desire.
Do an INSERT/SELECT to move the data.

All the data type translations will be done for you by the driver.

If you have thousands of spreadsheet tables, I would suggest using a
specialized tool for the job instead of a manual process to eliminate
errors.

You might want to rename the tables imported by the ODBC driver for MS
Excel, because it will have strange default names like:
country_codes_Excel.dbo.`Sheet1$` which are not exactly enlightening,
unless the spreadsheets already have reasonable names spelled out for
them.

Show quoted text

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of
Daniele Beauquier
Sent: Friday, September 17, 2004 9:51 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Import an Excel table to a Postgresql one

How to import an Excel table into a Postgresql table in a simple way?