Exporting a Postgres Database to an Excel Spreadsheet
This is not really a programming answer, but this has already been programmed, if exporting to CSV is acceptable.
You can look into:
If you have access to a Mac then Navicat for PostgreSQL Lite will allow you to do exactly this and is available for free in the Mac App Store. It is really simple to use and has a great interface to setup the connection to the database and to browse to the information you need.