In this post, we’ll share a PowerShell script that removes quotes from all CSV files in a folder. The script creates new CSV files with “_noQuote” appended to their names for every CSV file it iterates through.
Always have backups before running scripts, especially when dealing with important data. You will have to amend the $csvFolderPath variable to the location of your CSV files before running this script.
# Specify the folder path containing CSV files $csvFolderPath = "D:\csv-Demo\" # Process all CSV files in the specified folder Get-ChildItem $csvFolderPath -Filter *.csv | ForEach-Object { $outputFile = Join-Path $_.DirectoryName "$($_.BaseName)_noQuote.csv" Import-Csv $_.FullName | ConvertTo-Csv -NoTypeInformation | ForEach-Object { $_ -replace '"', '' } | Out-File $outputFile -Force -Encoding ascii }
Remember to monitor your system performance if you are dealing with large CSV files.
If you’d like more information on removing quotes from CSV files with PowerShell, feel free to check out our other post: PowerShell Guide: Removing Quotes from CSV Files
One thought on “PowerShell Script: Remove Quotes from CSV Files in a Folder”