Beta 42

Research and Development

Menu

PowerShell - Preserving Special Characters in Excel-generated CSV files

When you save Excel spreadsheets to a CSV file, special characters get lost. That's because Excel is saving the CSV file using very simple ANSI encoding.

The following line re-encodes the CSV file and uses UTF8 encoding, making special characters readable for Import-CSV:

$Path = "c:\somepathtocsv.csv"
(Get-Content $Path) | Set-Content $Path -Encoding UTF8