Postgresql – How to import multiple CSV files to a postgres table using pgadmin or other method

copycsvimportpgadminpostgresql

I'm looking to import a folder of over 100+ csv files into one table on PostgreSQL using pgadmin. I have the following script but is there a way to change the file path to all csvs?

COPY schema.table FROM ‘C:\Documents\Data’ DELIMITER ‘,’ CSV HEADER;

Best Answer

  1. Use your computer's command-line environment to list the names of all the files in your directory
  2. Use the list of files to create the commands you want
  3. Manually tweak your commands line-by-line or change the formula/process you used in step 2 until you get the output you want.

Gl;hf ;)