ADBlock is blocking some content on the site

ADBlock errore

Enabling import/export flows between a remote postgres database and excel workbooks

StackOverflow https://stackoverflow.com/questions/9351487


I am trying to create a program that can import a postgres database table into excel via VBA, let someone make edits, and then export the edited data as a new table into the database via VBA.

This would be a relatively simple (although procedurally convoluted) task to accomplish if the process did not have to work with both windows and mac versions of office.

My original plan was to simply have the users download python and then install the psycopg driver. I would then store a python script as a string in a vba module which would write the python script to a file, pass an SQL string to the python script and have python grab the data directly from the database. Python would then split out a file, which would cause a VBA loop, waiting for the file to exist, to terminate and then import the data and fill a spreadhsheet.

Writing would simply entail the same process except that excel would export the sheet containing data to be uploaded to postgres before calling the script.

Unfortunately having a user install psycopg2 on a mac would be leave the leave them in state of misery, as the package cannot be simply downloaded and installed without downloading a massive 1+ GB package known as "xcode" and then installing mac ports just to be able to run a simple python script to connect to postgres (and even this doesn't actually work)! Needless to say, this is simply unacceptable.

My programming experience comes mostly from creating scripts to run on local machines, so I am not really sure how I would accomplish this.

The easiest way I could think of is to set up some kind of python based server on the ubuntu machine that houses postgres and somehow allow the local python scripts generated by the excel workbooks to send it streams of data which the script would then upload to the postgres database. For export from the database to excel, the local python script would send commands to the python based server which would then upload the data to an ftp server. Subsequently,the local python script would donwload this data, process it, and output it to a file, allowing excel to access it.

Basically, I just need a solution that allows a python program, executed from a user's machine, to connect to the postgres housing machine and tell it to run a script that either generates a file for download or somehow streams the data back directly into the user's python program without requiring the user to download any external programs.

I have begun the process of learning the basics of java, so if java allows for an easier way of accomplishing this task, I would be very willing to try it out. As of the date of this post I have only been programming in java for 1.5 days though... so please keep that in mind when answering.

Thanks in advance!

No correct solution


Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow