Search code examples
powershellexport-to-csvdecimal-point

Export to CSV setting the decimal separator


I have data I want to export to CSV from PowerShell. I use ConvertTo-Csv to create the data and then pipe it out to a file, works fine, but...

My data gets written with a comma as decimal separator. I need this to be a "." point.

There must be something I'm overlooking here.


Solution

  • Change the NumberFormat property of the current culture:

    (Get-Culture).NumberFormat.NumberDecimalSeparator = '.'