How do I copy a CSV file into a Postgres Table?

Issue

You want to copy a .csv file from your local machine to a Heroku Postgres table.

Resolution

Run heroku pg:psql -a <application_name>.

Once the Postgres shell opens, run

DATABASE=> \copy table_name FROM csv_file.csv WITH (FORMAT CSV);

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support
Terms of Service Privacy Cookies © 2020 Salesforce.com