Data manipulation inside excel cell

I have a excel and used datatable to store the data. In one column “Description” we have to reverse the cell value if the value starts with string.
For example:
Description
Amount is 123456
987654
Amount is 234567
876543
Amount is 234567

here i have to check each row whether it starts with number. If it contains string that start with text, we need to make it start with number like below:
For example:
Description
123456 Amount is
987654
234567 Amount is
876543
234567 Amount is

Hi there @harshit_gupta welcome back to UiPath Community.

I guess there are many questions that need answering before suggesting a solution.

  1. The values are never null?
  2. Will there always be a number present in the data table cell?
  3. The number is always either in the first or at the last and never in between?
  4. Will the number be always delimited by a space?
  5. Is the string value definitely required or can it be cleaned off?

If I have to go with the assumption that the number is always delimited with a space and will either appear as a standalone pure number or within a string delimited by spaces and appears at the last then you can simply split the whole value from space and get the last item of the array and build the string using the join function.

If there are only numbers then you can move ahead with your processing. But if any of the responses is ‘no’ for the aforementioned questions then it would require more engineering/logic.

1 Like

Hi raghavendra,
Please find the answers:
Values cannot be null
Number present in data table cell is not necessary, it can also have simple text.
Yes Number will either be in first or last, it wont be in between.
yes with space
string value is required.

Then the solution provided holds goo. Just check ‘starts with’ or split and checkf or Regex match and then you are left with only two condition.

  1. Starts with number
  2. Ends with number ( in this case you split it using spaces and build the string)
1 Like