Home QuickTipps How to find the list separator character
 

How to find the list separator character

To find out the list separator character used by your computer, use this line:

(Get-Culture).TextInfo.ListSeparator

You can change this character in your control panel regional settings. Many programs use the character to process “CSV” files (comma-separated values).┬áSo in Germany, for example, the list separator character typically is “;”, while in the US, it is “,”.

How to Read and Write CSV Culture-Neutral

Why is it important to know? Because programs like Microsoft Excel and others use this character as a delimiter when they import and export “CSV” files.

So basically, when you save an Excel Spreadsheet as CSV file, the values in the exported file are not necessarily separated by commas. Instead, Excel uses the list separator character.

That’s why the following two lines of code are basically the same:

Import-CSV 'C:\users.csv' -UseCulture
Import-CSV 'C:\users.csv' -Delimiter (Get-Culture).TextInfo.ListSeparator