How to Import CSV file to a table in PostgreSQL?
Using SQL Query
COPY table_name FROM ‘/path_to_csv_file.csv’ WITH FORMAT csv;
COPY table_name FROM '/path_to_csv_file.csv' DELIMITERS ',' CSV;
Keep in mind that you have to keep the column names on the csv file the same as columns of the table.
Using TablePlus, you can import csv via the GUI.
New to TablePlus? TablePlus is a GUI client for multiple relational databases which is native, beautiful, and available for free. Check it out: Download TablePlus here.
To import a CSV file to a current table:
File > Import CSVfrom the menu bar
- Right-click on the table in the left sidebar or right-click in the data content and choose
After importing, press
Command + R to reload current workspace.