Exporting and Importing CSV files to Heroku postgresql
Export
On your local db console:
copy (select * from your_table where xyz) to '/tmp/rows.csv' With CSV;
Import
To import above rows to your heroku db, first make sure to do a backup
heroku pgbackups:capture --expire -a your_app
Then the actual import
psql `heroku config:get DATABASE_URL -a your_app`?ssl=true -c "\copy your_table FROM '/tmp/rows.csv' WITH CSV;"



