regexp replace – trim trailing spaces in double quote string in Snowflake

I have csv file where the fields are within double quotes. The field value contains lot of trailing spaces and i want to trim trailing spaces which is inside double quote string. The problem is i cannot use regexp_replace logic because i have 100 columns.

Below is example of csv file:

"TRD"|"VVR"|"DESR"|"RTES"|"TGHZ"
"03509431345 "|"14488701   "|"BV-GEB   "|"5 "|"01"|

Below is my Copy Into command:

COPY INTO RTZU
    FROM @Upload_file
    PATTERN = '^wer[0-9]{8}.*$'
    FILE_FORMAT = (FORMAT_NAME = 'PP_LO');

I can remove double quotes from csv delimeter but then there should be special delimeter i need to use because some columns in csv file contains long text field values and if this delimeter contains in text value then it will break the columns and copy into command will fail.

Read more here: Source link