How to read MS Excel cell and base next action on the first two characters of that cell

In Excel, I am stepping through each row.
I want to check a certain cell, this cell is either empty or not empty (I check if the cell is not empty)

Now my actual quesion:
Cell contents are order numbers, that can start with “TR” or “GT” or “ST” (e.g. “TR123456” or “ST654987”)

  1. I need to check/read what the two left characters are
  2. If those are the same as the previous not empty cell (starting row 2)

Hi @sraar.jans-beken

Can you explain the 2nd point a bit more ??

If those are the same as the previous not empty cell (starting row 2)

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Let’s say:
cell B4 = “TR123456”
cell B5 =
cell B6 = “TR456789”
cell B7 = “GT654324”

As I can skip empty cells, B5 is not of interest. And depending of the first the characters “TR” (or something else) it determins if I have to do some extra steps in a program, or I dont have to do those extra steps and save time (steps are changing responsibility)

So, when done doing the steps needed for value B4
I can skip the next as B5 is empty
As B6 also starts with “TR” I do not need to do some extra steps
As B7 start with “GT”, I have to do the extra steps

Hi @sraar.jans-beken

So for identifying the initial characters you can use regex as below :-

image

And in the nested if condition you can check If that particular Cell Value contains that Initial 2 Characters then you can proceed further

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

hi @Pratik_Wavhal

did you add the regex101 ad??

How do I do this in Studio X?

Is there a way to give you a quick call?

Hi @sraar.jans-beken

Below is the workflow i have made :-
MainPratik.xaml (12.8 KB)
New Microsoft Excel Worksheet.xlsx (9.0 KB)

I have made this in normal UiPath Studio and not in StudioX

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

Hi @Pratik_Wavhal,

To what location do I need to copy those files?
(I am still not a very exerienced user :slight_smile: )

Hi @sraar.jans-beken

From anywhere you can open that .Xaml File

Create one folder on desktop or anywhere and copy these both files der and then open .Xaml file in UiPath Studio and again give the Excel file path in Excel Application Scope Activity and directly run it.

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

I tried that, but got an error message (screenshot)

image

Hi @sraar.jans-beken

So as i have developed the Workflow with normal studio and you are opening it with StudioX so this error is getting occur

So i can show you the workflow by SS which will help you to develop the same in StudioX :-

image

Properties on Matches Activity :-

Note :- Where initialCharacters is the output of Matches Activity

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

Hi @sraar.jans-beken
I would do this as below (I missed the blank criteria because it seems you are ok with this!). “dt_ExcelFile” is the data table variable which you pulled your excel file into.

Hi @ZoeW & @Pratik_Wavhal,

I am using StudioX. Is there a way to assign a value to a variable? you both use Studio

Sorry @sraar.jans-beken, totally missed that.
I have found this post where there is a handy document on creating variables in studio x. StudioX - variables and arguments

Hi @sraar.jans-beken

We in Studio have variable panel down as you can see in Screenshot :-

So der is Default section right side where we can assign value to the variables that you want.

Another way is by using Assign Activity.

So look is der anything same in StudioX or not

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Try IF activity and condition builder from it.

Thanks all for your replies.
I used the “process notebook” to write data, and created some formulas there to do the logic I want.

2 Likes

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