Export CSV with Culture-Specific Delimiter

by Mar 15, 2010

Export-CSV used to only support the comma as separator, which caused problems on non-U.S.-systems. In PowerShell v.2, with -useCulture you can have Export-CSV use whatever delimiter is the right one, depending on your culture.

There is only one caveat: You should never combine -useCulture with -Encoding Unicode. This seems to be a bug where the culture-specific delimiter is not inserted correctly, which causes importing applications, such as Export, to ignore it.

You should use -Encoding UTF8 instead if you want to preserve special characters in your export:

Get-Process | Select-Object Name, Company |
Export-CSV -useCulture -Encoding UTF8 $home\export.csv

Twitter This Tip! ReTweet this Tip!