This is going to be a short article which will illustrate importing and exporting a table from or to a csv file using PostgreSQL COPY command. Importing a table from CSV Assuming you already have a table in place with the right columns, the command is as follows COPY FROM ‘/path/to/csv/SourceCSVFile.csv’ DELIMITERS ‘,’ CSV; Exporting a CSV from a table. COPY TO ‘/path/to/csv/TargetCSVFile’ DELIMITERS ‘,’ CSV; Its important to mention here that generally if your data is in unicode or need strict Encoding, then Always set client_encoding before running any of the above mentioned commands.