PowerShell Script: Remove Quotes from CSV Files in a Folder

PowerShell Script img

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
}
PowerShell Remove Quotes from Many CSV Files

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 response to “PowerShell Script: Remove Quotes from CSV Files in a Folder”

  1. […] the Get-ChildItem cmdlet: – PowerShell Script: List Files with Sizes and Dates– PowerShell Script: Remove Quotes from CSV Files in a Folder– PowerShell Script: Deleting Files Older Than a Specific Date– PowerShell Script: Count […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Popular Posts

Blog Categories