COPY query with variable path
Yes, for example: 

FUNCTION insert_file (IN filepath VARCHAR(255)) ... 
sqltxt:='COPY table_name from '''||filepath||''' with (FORMAT csv)';
execute sqltxt; 


'''||variable||''' will produce 'value' with quotation marks.

'||variable||' will produce the value without quotation marks. usefully for table names and integers for example. 

You need to declare sqltxt as text.