web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Incorrect decimal plac...
Power Automate
Unanswered

Incorrect decimal placing when copying excel value

(0) ShareShare
ReportReport
Posted on by 9

Hi!

I have a problem when copying data from one Excel to the other in PAD.

I have a report with several amounts. In the report there is one number shown in the column, but another number ‘behind’ in the formula bar. When PAD copies it to the other excel document the comma happens to end up at the end so that the number gets totally wrong.

 

What’s shown - 114,79

What’s in formula bar - 114,790000000001

 

What’s shown in the new excel when pasted -114 790 000 000 001,00.

 

Number format is Custom.

 

Maybe could work if I add decimal places?

But not the most beautiful solution and I don’t know if that would cause other troubles with other reports.

 

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Are you copying an entire tab, just the amounts to a new column, or just specific amounts to certain cells?

    I am wondering, if it is not a straight copy and paste, we may be able to use formulas to get what you want, and if it is a column or spreadsheet copy and paste, we may be able to use macros.  I've seen this a lot lately with non-US regional setting issues.

  • linakalstrom Profile Picture
    9 on at

    I'm copying an entire tab. Would be great if you have a solution to this!

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Pasting or writing numbers to Excel can be tricky due to the separators used. I suggest using Read from Excel worksheet instead of copying. This will result in a datatable variable. You can then use the Find and replace in a data table action to replace unwanted values and even incorrect decimals. Then use the Write to Excel action to write the table to the other sheet.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Just to confirm, the process is something like this?

    Open up recent report (new excel file)
    Copy all the data from specific tab

    Open my Excel File

    Overwrite all the data in this specific 'existing' tab

    Move on with the flow

     

    If so, I recommend Excel VBA.  We can create a Macro workbook where the bot writes to cells within the macro workbook and the Macro will read those cells to perform the Macro.  Example:

    Create a Macro workbook with that looks like the following, be sure to Save As .xlsm:

    MichaelAnnis_0-1688143423541.png

     

    Create the following Macro by going to View -> Macros:

    Sub CopyDataBetweenWorkbooks()

     

    ' Declare variables
    Dim From_Workbook_FilePath As String
    Dim From_Workbook_FileName As String
    Dim From_Workbook_SheetName As String
    Dim To_Workbook_FilePath As String
    Dim To_Workbook_FileName As String
    Dim To_Workbook_SheetName As String

     

    ' Get values from cells
    From_Workbook_FilePath = ThisWorkbook.Sheets("Sheet1").Range("B1").Value
    From_Workbook_FileName = ThisWorkbook.Sheets("Sheet1").Range("B2").Value
    From_Workbook_SheetName = ThisWorkbook.Sheets("Sheet1").Range("B3").Value
    To_Workbook_FilePath = ThisWorkbook.Sheets("Sheet1").Range("B4").Value
    To_Workbook_FileName = ThisWorkbook.Sheets("Sheet1").Range("B5").Value
    To_Workbook_SheetName = ThisWorkbook.Sheets("Sheet1").Range("B6").Value

    ' Create workbook and worksheet objects
    Dim From_Workbook As Workbook
    Dim From_Sheet As Worksheet
    Dim To_Workbook As Workbook
    Dim To_Sheet As Worksheet

     

    ' Open the from workbook and get the from sheet
    Set From_Workbook = Workbooks.Open(From_Workbook_FilePath & From_Workbook_FileName)
    Set From_Sheet = From_Workbook.Sheets(From_Workbook_SheetName)

     

    ' Open the to workbook and get the to sheet
    Set To_Workbook = Workbooks.Open(To_Workbook_FilePath & To_Workbook_FileName)
    Set To_Sheet = To_Workbook.Sheets(To_Workbook_SheetName)

    ' Clear the To_Sheet
    To_Sheet.Cells.Clear

     

    ' Copy the entire data from From_Sheet to To_Sheet
    From_Sheet.Cells.Copy Destination:=To_Sheet.Cells(1, 1)

    ' Save and close the workbooks
    From_Workbook.Close SaveChanges:=True
    To_Workbook.Close SaveChanges:=True

     

    End Sub

     

    When the bot gets to this point, you will have the bot open the workbook, fill out B2 through B6 and then run the Macro.  It should run same as if you copied and pasted yourself.

     

    Best of luck!  

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    I'm quite surprised by how frequently you suggest using VBA, when that is really not even close to best practice.

     

    If scripting is the option that one should go with, using VBscript or PowerShell is a much better option, because the script itself is stored in the PAD flow and not in an Excel file itself. Also because there are plenty of systems and GPOs that do not allow using macro-enabled files.

     

    I would suggest going with the normal Excel actions for everything that can be done with them, and using VBscript/PowerShell (basef on preference) for anything that cannot be done with the basic Excel actions.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    This has been a recurring theme recently when there is a regional setting issue between PAD and Excel for date and number formats.  I commonly see "it works fine when I do it, but when I have PAD do it, it reformats the date (or number)."

    I choose VBA because it's what I know.  And I only use it for manipulating Excel.  I don't even use it for Get Files, because it's faster and easier to build for PAD to just tell it what the file is.  There's a thousand ways to skin a cat, but when people say "PAD is breaking Excel", I say, "don't use PAD to manipulate Excel".  The other big one is what PAD can only do row for row with a datatable, like a "for each," VBA can do much faster, and I'm sure there are even faster languages or better SQL processes, but I unfortunately, I haven't learned every process out there.  It's just a solution, and in this case, a fast, 5-min build solution that works around the issue that is currently happening.    

     

    I wish MS would just fix it, because it's a recurring issue, but so far, no one has come up with a regional setting fix within PAD, Excel, or Windows, to stop this from happening.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    I agree it is a recurring issue with PAD and regional settings, especially when writing to Excel. I just disagree with using VBA (and suggesting others should use it). Using VBA requires a macro template file or adding a macro to the target file, neither of which is an optimal solution. The code becomes dependent on the file in question and this can easily be lost. Also, as mentioned, quite a few corporate IT security policies prevent the use of .xlsm files.

     

    VBscript is very similar in its syntax to VBA and can be invoked directly from PAD. This means there is no need to have the code stored on some file (be it a template or the target file). It's in the flow and as such is easier to maintain and creates less external dependencies. It also means most traditional IT security policies will not block it. It will also have the same benefits in terms of performance, etc.

     

    The same applies to PowerShell scripts, but the syntax there is quite different, so it's more of a stretch to learn that when you know VBA than it is to switch to VBscript.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    I’ll definitely check it out @Agnius.  I have been employed in global companies with 31k employees and never ran across that issue, so I was unaware. Will definitely look into VBScript though as to my understanding, it is more MS wide than just Excel VBA. Any you tube profiles that you have to get started might help. Thx. 

  • linakalstrom Profile Picture
    9 on at

    Thanks for the replies!

    We used 'Read from excel' previously but if I remember correctly we had the problem appear directly in the created table... Will check this again after holidays and get back to you - hope to not need VBScripts as this is out of comfort zone. 🙂

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 275 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 235

#3
David_MA Profile Picture

David_MA 178 Super User 2026 Season 2

Last 30 days Overall leaderboard