'Why doesn't Copy or \copy work for me in Pgsql?

I am trying to import data from a csv into postgres. I have tried the following and got the following errors:

Copy TA_Files 
FROM 'C:\Users\ABla47\Documents\TA 11.19.21.csv'
DELIMITER ','
CSV HEADER;

ERROR: could not open file "C:\Users\ABla47\Documents\TA 11.19.21.csv" for reading: Permission denied

HINT: COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy.

SQL state: 42501

Then I tried:

\Copy TA_Files 
FROM '\Documents\TA 11.19.21.csv'
DELIMITER ','
CSV HEADER;

ERROR: syntax error at or near ""

LINE 1: \Copy TA_Files

Can someone help me know what format I need to use to get the data from the csv into the table?

Thanks



Solution 1:[1]

this worked for me:
I placed the files in C:\Program Files\PostgreSQL\14\pgAdmin 4 directory and copied it from there.

COPY superstore_people(person, region)
FROM 'C:\Program Files\PostgreSQL\14\pgAdmin 4\superstore_people.csv'
DELIMITER ','
CSV HEADER;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MyICQ