PostgreSQL Query to Excel Sheet PostgreSQL Query to Excel Sheet postgresql postgresql

PostgreSQL Query to Excel Sheet


You could install the PostgreSQL ODBC driver on the Windows machine, and then connect Excel to the database like explained in this blog post (except using ODBC rather than OLEDB).

I haven't tested this. I'm not really sure if this makes it any easier than exporting CSV and fixing it (given what Excel is like).

EDIT (thanks @Tometzky): The best solution is to use the PostgreSQL ODBC driver to connect Microsoft Access to the database and from Access export to Excel.


Apparently you can use Power Query Add-in and the .Net PostgreSQL Data Provider for importing PostgreSQL data into Excel 2010 or Excel 2013...

Downloadhttp://www.microsoft.com/en-au/download/details.aspx?id=39379

How to for using PostgreSQL:https://support.office.com/en-ie/article/Connect-to-a-PostgreSQL-database-bf941e52-066f-4911-a41f-2493c39e69e4


This is fairly easy.

Make this the first line of .asp page: <%response.ContentType="application/vnd.ms-excel"%>

Make the rest like any other HTML page with a table in it.

Use ASP to fill the table with data from the database.

The server will create an Excel spreadsheet for you.