Problem with writing in excel

Hi,

I had to write in excel different values but for which begining with “0” eg “05987”. the robot write it “5987”

I’m trying to use substring with padleft

 ig row(11).ToString.Substring(0,1) = 0 then row(11).ToString.PadLeft(1, ''')

Use row(11).tostring.substring(1) which eliminates 0 @abdel

If i understand, the text you want to enter into excel is “05987” But BOT is writing it as “5987”.
This is because of the data type conversion. If you convert the value into string, BOT will write it as “05987”.
One solution you is when you are updating the row value, use,
row(11).Item(0) = String.Format(“0{0}”, 5987)

If the problem is other way, i.e., if you want to write it as 5987 and BOT is writing it as “05987”, then convert it to integer, thus 0 will be eliminated.
row(11).Item(0) = Convert.ToInt32(“05987”)
or
Convert.ToInt32(row(11).tostring)

i had tryed it but:

Hi @abdel,

If you want to remove the leading zero, just try .ToString.TrimStart function.

Ex: row(11).ToString.TrimStart("0"c)

I think you should change the cell property in excel to text. I think that excel removes the leading 0 automatically.