How to check wether the input format in excel is right or wrong

Hi everyone, I am new to UIPath. Can you please tell me how to check if input in excel is in required preference or not.
This is the input sheet:-

figure:- ( eitehr 8 number or 8 number + 1 character following it)

  1. 52182185
  2. 52182185A
    task:
  3. P_521373_720_AE_0001_T_A
    Cust V:
  4. QFA
  5. QTR
  6. SIA

If this format is not met by any row then write invalid in status otherwise write pending. It’s urgent…

1 Like

Hello @Krishna_Sanghi,

Here is simple solution for your problem.

  1. Take an assign activity create Boolean variable and in assign use System.Text.RegularExpressions.Regex.Match(row(“figure”).ToString,"^([0-9]{8}[a-zA-Z]|[0-9]{8})") AND System.Text.RegularExpressions.Regex.Match(row("Cust V").ToString.ToUpper,"^(QFA|QTR|SIA)")

This will give a boolean value and you can use this accordingly like in if condition True = row(“Status”)=>Pending ,Else = row(“Status”)=>Invalid

Hey @Krishna_Sanghi,

Happy in welcoming you to UiPath community.

  1. Read the Excel Data - using Excel Application Scope & Read Range Activities

  1. Do validation based on the requirement
    For Example - Here below I have used IF Block and checked using Regex

Hope this helps.

Thanks

Hi @Nithinkrishna,

I tried your method but I am not getting any output through this. Though the code runs without any error. Can you please tell me if any change is req.

1 Like

Hi @Akshay07

Thanks for the reply. It’s showing an errorScreenshot (33)

This is just an approach you can follow. You will need to build logic as per your sheet.

ping me on sg2070156@gmail.com

Hi @Krishna_Sanghi

There is in update in query instead of Match use IsMatch

Here is the update query

System.Text.RegularExpressions.Regex.IsMatch(row(“figure”).ToString,"^([0-9]{8}[a-zA-Z]|[0-9]{8})") AND System.Text.RegularExpressions.Regex.IsMatch(row(“Cust V”).ToString.ToUpper,"^(QFA|QTR|SIA)")

Also make sure the column is same.

Hi @akshay
there are 2 issues with this updated query although it is working fine

  1. it is not printing anything in status column, i used and for and if loop.
  2. when the figure is let say “52107041-120 — TIE” then also it is going through true in if condition.
    this is something I have done
    .

Hello @Krishna_Sanghi,

Firstly the checking_input is a boolean value,so no need of checking_input = True only checking_input is fine.
After assigning to the column have you written the updated data table in excel using write range or any activity?

For the second point ,may be you have forgot to put end , i.e $ dollar sign at the end so change in regular expression to image

1 Like

Hi @akshay
I used the write cell but it was writing somewhere else due to my mistake. but now it’s fine…
Thanks a lot it worked… :grin:

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