hello all,
I would like to remove leading zeros from a data table column. please check my data.
from depost column i want to remove leading zeros. Would you please suggest me how would i achieve this.
Thanks in advance.
hello all,
I would like to remove leading zeros from a data table column. please check my data.
from depost column i want to remove leading zeros. Would you please suggest me how would i achieve this.
Thanks in advance.
first read the excel file using read range and store in dt1 variable
dt1.AsEnumerable().ToList().ForEach(Sub(row) row(“Depost”)= CInt(row(“Depost”).ToString))
write the datatable dt1 to excel using write range
Hope it helps
.
Regards,
Nived N
Happy Automation
Follow weblink, check if zeros are running away.
if works, then you have to automate that part before you actually read excel
I did not get any web link . Would please re send .
I’m sorry, here you go,
it is working . Thank you.
hello,
I would like to take one more suggestion from you . my actual requirement is I will remove leading zeros only when the length of the string less than or equal 6 in depost column. for more reference I have also added the data.
I will be very humbled if you give me some suggestion.
thanks in advance
Hi @roysupriya21
for this we had to do some modifications in same code as i told above
Modified code
dt1.AsEnumerable().ToList().ForEach(Sub(row) row(“Depost”)= If(row(“Depost”).ToString.Length<=6,CInt(row(“Depost”).ToString),row(“Depost”)))
Try this and let me know if it works
Regards,
Nived N
Happy Automation
Hi @roysupriya21
sorry, there was mistake, i had corrected the code, please look that
Regards,
Nived N
Happy Automation
Thanks a lot . it is working perfectly.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.