OK then this updated example should help.
$testfile = New-TemporaryFile
@'
Test Name1 ,Test Name1b ,99999999,Test Name1a
Test Name 2,Test Name 2b,38357,Test Name 2a
Test Name 3 ,Test Name 3b ,32434,Test Name 3a
Test Name 4 ,Test Name 4b ,36181,Test Name 4a
Test Name 5 ,Test Name 5b ,36111,Test Name 5a
'@ | Set-Content -Path $testfile -Encoding UTF8
$docSetInfos = Import-CSV $testfile -Header Name,Description,CustCode,CustName
$docSetInfos |
ForEach-Object {$_.psobject.properties |
ForEach-Object {$_.value = $_.value.trim()}}
$docSetInfos | Export-Csv $testfile -NoTypeInformation
notepad $testfile
Notepad now shows
"Name","Description","CustCode","CustName"
"Test Name1","Test Name1b","99999999","Test Name1a"
"Test Name 2","Test Name 2b","38357","Test Name 2a"
"Test Name 3","Test Name 3b","32434","Test Name 3a"
"Test Name 4","Test Name 4b","36181","Test Name 4a"
"Test Name 5","Test Name 5b","36111","Test Name 5a"
Which would make your code
$path = 'C:\Users\SP2019-Farm\Desktop\customerstest.csv'
$docSetInfos = Import-CSV $path -Header Name,Description,CustCode,CustName
$docSetInfos |
ForEach-Object {$_.psobject.properties |
ForEach-Object {$_.value = $_.value.trim()}}
$docSetInfos | Export-Csv $path -NoTypeInformation