Notes: To import a csv into a heroku table

if you want to import a csv to a heroku table, execute the following command:

psql `heroku config:get DATABASE_URL -a your_app`?ssl=true -c "\copy your_table FROM '/tmp/rows.csv' WITH CSV;"

Replacing your_table and your_app with the appropriate info

Notes: To import a csv into a heroku table

One thought on “Notes: To import a csv into a heroku table

  1. John's avatar John says:

    I need to change it slightly to work for me: psql `heroku config:get DATABASE_URL -a your_app_name`?ssl=true -c “\copy company_infos(email, url, created_at, updated_at) FROM ‘/Users/john/company_infos_heroku4.csv’ WITH(FORMAT csv, HEADER true);”

Leave a comment