Last Updated: May 31, 2017
· joho

The quickest way from Postgres to a spreadsheet

Need to quickly get some data out of Postgres and into Excel/Numbers/Google Docs/etc?

copy (select foo, bar from baz) to stdout with csv;

From within any psql prompt (including the heroku one) and then you can just copy/paste into your spreadsheet program of choice.

For google docs I've found it works better to paste it into a CSV file and then upload it rather than dicking around with copy and paste.

1 Response
Add your response

Nice tips. I'm on OS-X and getting data into numbers or google docs wasn't super smooth me when copy-pasting. I had to save the .csv file to disk, and open that in numbers or google docs. Copy/paste didn't split columns on the commas.

TY for the helpful post. I learned some new postgres syntax from this.

over 1 year ago ·