Excel read amount column not giving me leading or trailing zeroes

Hi,
I am reading amount from Excel 1234.20 or 1234.00 with ToString conversion. I am not getting the zeroes leading or trailing. Thank you,

Hey @A_Learner
Try this method:
amount.ToString("F2") = 1234.00 format

image

1 Like

Hi @A_Learner

Try enabling Preserve Format Option in the Property.If the output DataType is System.String then it will print the exact value present in excel. If you Output variable DataType is System.Double then use strvar.ToString("F2")

Without enabling Preserve Format Option also you can do the process but Output DataType should be System.Double and you should use the syntax strvar.ToString("F2")

Please specify what are the activties are you using.
Input:
image

Enabling Preserve Format and output DataType System.String

Enabling Preserve Format and output DataType System.Double
Value1.ToString("F2")

Without enabling Preserve Format output DataType System.Double

Hope you understand!!
Regards

1 Like

you can convert the data to text format before reading it @A_Learner

  1. open excel, highlight the column containing the text
  2. data-> text to columns
    image
    3,. click next until this page, click text and finish
  3. now if you read from UiPath the leading/trailing zeroes will be there!

Thank you so much for teaching me something new @vrdabberu @pikorpa @jack.chan

1 Like

You’re welcome @A_Learner

Happy Automation!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.