Filed under perl, api, sql, and google-docs
I created sql2xls.pl initially about 6 months ago, because I was tired of trying to remember to MySQL's SELECT … INTO syntax. Plus, then I'd have to download the CSV, format it in a method that MS Office could use, and then email the data.
Instead, this script was born. It takes a series of parameters to determine what SQL queries to execute, and takes the output and uploads them to Google Docs, giving headers to the columns. Google Docs attempts to format the data as best it can (determining, for example, if a date is really a date).
It's only confirmed to work with MySQL, but I'm sure it would work with PostgreSQL (as well as really anything else that Perl's DBI can handle).
The only real downside is that the spreadsheet you're pushing data to has to already exist. The Google Docs API (as of this writing) has no functionality for creating spreadsheets).
Check out the script on Github. If it's useful to you, make some updates, or just some suggestions.