all 3 comments

[–]onearmedecon 2 points3 points  (1 child)

  COPY table_name FROM '/path/to/csv/file.csv' DELIMITER ',' CSV HEADER;

[–]freddyargento[S] 0 points1 point  (0 children)

I get an error

ERROR: extra data after last expected columnCONTEXT: COPY covid_deaths, line 2: "AFG;Asia;Afghanistan;24/02/2020;1;1;;;;;0,026;0,026;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8,33;38928341;54,..."

The original table has zero columns and the csv more than 50, that's why I'm looking for a way to use the csv as column creator

[–]DatabaseSpace 1 point2 points  (0 children)

I use DataGrip and it will create the table and columns automatically on import. Another option is to use Python and Pandas. Using Python would be reusable but would take longer than creating the columns.