views:

194

answers:

4
+2  Q: 

Excel and pgSQL

How do I import data from a excel sheet onto a PGSQL database on linux?

+2  A: 

The easy way is to export the data from Excel, to a CSV by using the SAVE AS functionality. Then use psql's native \COPY feature. You can find more information about it by using the command \? COPY in psql, or by visiting the docs on COPY.

Evan Carroll
+1 Be prepared to deal with formats-datatypes issues, though.
leonbloy
A: 

Another option (a bit of a workaround, but should work) is to import the Excel file into Access and then upping the resulting table into PostgreSQL over an ODBC connection.

ChristopheD
A: 

If you do this on a regular basis, then you should look into Aqua Data Studio - I've found it pretty useful.

caf
A: 

I do this all the time and use Navicat[1] (about $79). You'll need a windows box to run the client as the linux client can't import from Excel.

You can import almost any data format (Access, Excel, DBF, Lotus ...), define a mapping between the source and destination which can be saved.

BTW I don't work for Navicat! Just I've tried a few DBA clients and this was by far the best for data imports.

[1] http://www.navicat.com/en/products/navicat_pgsql/pgsql_overview.html

Will