I have a scenario where I have 2 columns in an excel file. Now how can I fetch the last 2 numbers from the 2nd column for every row of an excel file?
First find the length of that string then use Remove method and mention like this:
str.remove(0,str.length-2)
You can do it by following the below steps…
- Read the excel data to a datatable using Read Range activity.
- Use a For Each Row activity to loop through the datatable.
- Use an Assign activity within the loop with below condition
Row("Column2").ToString.SubString(Row("Column2").ToString.Length-2)
This is for your reference.
Thanks for your response. But, its not working.
Does it throw any error? Can you share the workflow file so I can look into it
yeah sure
Sample.zip (16.4 KB)
In the 2nd column of the excel file there are many fields and I would like to loop through them and select only the last 2 digits of each row.
I went through the workflow as well as the excel…
In the excel file, you have not included the column headers. So, in the workflow, you cannot specify “URL” because it will not find the appropriate column. So, I used the column index instead to locate the column that contains the URL info.
Also I added a For Each Row activity to loop through the datatable. Did some changes to the expression used to get the last two digits… Now it’s working fine…
Main.xaml (6.9 KB)
If this solves the prob, please mark it as the answer so that it will help others as well
Thanks! It really helped the purpose.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.