views:

496

answers:

1

I need to be able to import an Excel spreadsheet into a PostgreSQL database. The goal is for use with a Rails application. I have looked at the Roo gem and it takes 16 seconds to convert a 2000 line XLS file to CSV which is unacceptable. So I was wondering if I could just short-circuit the Rails application and import directly into PostgreSQL.

Is there a way to import data from an Excel spreadsheet directly into PostgreSQL?

A: 

No, PostgreSQL does not read the XLS file format (nor the XLSX format). You can import from CSV, and in some cases from XML, but that's all (without external preprocessing).

However, if you actually have access to Excel, you can always just export it in an open format (preferrably CSV) directly from inside Excel.

Magnus Hagander
That's unfortunate, I was hoping to find something similar to SQL Server's DTS functionality.
Matt Haley
No need to have such functionality built into the server. It's not built into SQL Server either - it's just bundled in "the box". I believe many generic tools will do it - most will talk to anything that has JDBC on the database side, for example.
Magnus Hagander