0

I am storing data in a backend database (PostgreSQL) which is running on a Linux machine. I want to be able to fetch data from the database, and populate a sheet in an excel workbook, so that I can carry out analysis in Excel.

It has been quite a while since I wrote anything in VBA, so I would appreciate some help (or links) in getting started. I would like to know the best way to approach this:

  1. Pure VBA solution OR
  2. Mixture of C# or other .Net language for data extraction logic and VBA for manipulating Excel objects (sheet data population etc)

Any ideas, tips, snippets and/or links that can help me get started on the twin objectives:

  • fetching data from a backend database (PostgreSQL) into Excel
  • populating a specified sheet in Excel with the columnar data retreived from the database

will be much appreciated.

Homunculus Reticulli
  • 65,167
  • 81
  • 216
  • 341
  • 1
    An alternative solution is to use PowerPivot. http://www.microsoft.com/en-us/bi/powerPivot.aspx. Here is how to connect to a databas other than SQL Server: http://stackoverflow.com/questions/4170658/accessing-mysql-db-into-excel-2010-powerpivot – LostInComputer Jan 13 '12 at 14:33

1 Answers1

1

If you are just trying to import data, Excel can do that without additional code. Just set up your windows client to connect to your postgreSQL server thru ODBC. (Here's one way guide to setting that part up: enter link description here

Then in Excel (Use a modern version, like 2007 or greater) from the "Data" tab, click on "Existing Connections" to connect to the ODBC connection you set up and pick the tables/data to import into excel. Once the spreadsheet has loaded the data, you can just click the "Refresh All" button to update the data.

jdh
  • 1,637
  • 14
  • 12