I need to change commas to dot in an excel file using Powershell

Fusionized 21 Reputation points

I need someone to help me solve this problem. I need to write a powershell script which changes the commas of the excel file to dots. The commas are between the numbers.
The table is built up like this:

user name user surname count count etc
example example 13,00 5,00 etc

I don't have any idea how to do it. I hope someone can help me.

Thank you in advance

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
4,732 questions
No comments
{count} votes

3 answers

Sort by: Oldest
  1. Rich Matheisen 36,161 Reputation points

    If you're asking about how Excel represents decimal numbers, or how you can change that, see here: change_the_decimal_point_to_a_comma_or_vice_versa.html

  2. Ian Xue (Shanghai Wicresoft Co., Ltd.) 18,766 Reputation points Microsoft Vendor

    The script could be like this

    $File = "D:\test.xlsx"
    $Excel = New-Object -ComObject Excel.Application
    $Workbook = $Excel.Workbooks.Open($File)
    $Worksheet = $Workbook.Worksheets.Item(1)

    This article is helpful.

    Best Regards,


    Please remember to "Accept Answer" and upvote if the reply is helpful.

    1 person found this answer helpful.

  3. Rich Matheisen 36,161 Reputation points

    Add this to the code given by IanXue-MSFT:

    $worksheet.Columns("YourColumnIDHere").NumberFormat = "General"
    1 person found this answer helpful.
    No comments