I know how to export table in Rails to formated Excel file: http://railscasts.com/episodes/362-exporting-csv-and-excel
But how to do that from console.
Connect to your Heroku database by using
heroku pg:psql
Then run the sql command to get the csv file e.g.
\copy (SELECT * FROM users) TO dump.csv CSV DELIMITER ','
Use \q to exit.
After executing the commands dump.csv would have been created in your local environment