How to get the specific excel cell value based from arguments

Please help.
I need to get the specific excel cell value (Service ID) based on tag message in arguments(in_Msg1)

Service ID :
image

Message Tag: "You’re now registered to TESTRPA1. <ABCD_EFG_AMOUNT_MB_TBD1>

1 Like

You mean the message tag is the cell comments @Juliene?

No @HareeshMR. Sorry for the confusion.

Message tag is from the input of user.

Now I want to get the corresponding Service ID of message tag TBD1 in excel. so for this one, I need to get 1234.

1 Like

in Excel Scope: Read Range → Data Table
then Filter Data Table → Get Data
or “for each row in Data Table” → Find correct row and extract data

You have that message . You need to get the last 4 characters and get the value corresponding to that 4 characters from the excel right @Juliene?

  1. Get the last four characters of the message(string type variable and assume name as message)
  2. Use for each row and loop through the data table
  3. Check as row(“Data Service ID”).tostring = message
  4. If matches, then get the required value

Thank you PeterK.
On this case, I have no idea on what TBD# is going to input by the user. Do you think using Filtered data table will solve this? Thank you :slightly_smiling_face:

Can you show me an example, please :slight_smile:
I got an error on my end. The row is not declared.

image

1 Like

No worries
Hope these steps would help you resolve this
—use excel application scope and pass the file path as input
—inside the scope use read range activity and in the range mention as “A6” and make sure that the row in excel starts from that row or based on which row it is starting we need to mention that cell in the range, or better start to read from row which is not the header or columnname so it would be probably “A7”
make sure that ADD HEADERS option is enabled if we are choosing with headers
—get the output from the read range activity with a variable of type datatable named outdt
—hope we have the in_argument with that string obtained ready to use here in this sequence
—now use a FOR EACH ROW activity and pass the datatable variable obtained as input
—inside the loop use a if condition and mention like this
in_Msg1.Tostring.Contains(row(columnindex).ToString)
If true it will go to THEN part where we can get the value of the SERVICE ID like this with a assign activity
str_output = row(columnindex).Tostring

Where column index usually starts from 0 for the first column
Or if we are taking column headers enabled then we can mention the column name as well
Like this
row(“columnname”).ToString

Hope this would help you
Cheers @Juliene

@Palaniyappan. It worked! Thank you so much.

1 Like

Great
Cheers @Juliene

1 Like

I have another concern regarding this matter. I need to replace the word “TBD6” to the corresponding Service ID, I have an idea of using Replace, but I don’t know how to figure it out. Thanks :slightly_smiling_face:

Example Message :
“You’re now registered to TESTRPA1. <ABCD_EFGH_IJKLM_MB_TBD6>.”

Upon getting the equivalent service id of TBD6(which is 6666), the new message will be:
“You’re now registered to TESTRPA1. <ABCD_EFGH_IJKLM_MB_6666>.”

image