Extract 2nd row value In Excel

Hi All,

I need to get value under condition that Column B shows “Completed”,
Can I know how can I get this value and how to set the if condition that Column B is Completed.

Capture

Many thx !

To be more specific, get the A2 time value under the condition that B2 is “completed”

Thank you for your help

@mason_wong

Try below steps.

  1. Use Read Range activity to read the data from excel and will give output as DataTable and say inputDT.
  1. And then try below select query.

         requiredDT = inputDT.Select("Action = 'Completed'").CopytoDataTable 
    

The above query will give you all rows whose action is Completed.

2 Likes

Hi lakshamn,

Thank you for your helping. But what if I want the first “Action = ‘Completed’”, how can I can handle? cuz there are so many "completed’ and I just need the very 1st one

whats your requirement ?
You want first data which status is Completed?

@mason_wong

Try below expression after filtering data to get first row value.

                  requiredDT(0)(0).Tostring
1 Like

yes, we will log the process completed time and I need to extract that “complete” time for the 2nd batch running

If you want time of first completed data
then use
Use Read Range—DT1
for each row For Dt1
then use If------- Row(“Action”).Tostring=“Completed”
Use Assign TimeComp=Row(“Time”).Tostring
Use Break in Then statement only.
it will look like this
image

1 Like

wow, awesome. thank you so much

Your Welcome!
If you got solution then mark it to close the topic

Can I know what variable types of DT1 and Row did you define? datatable?

As I have set read range output DT1 as Datatable, ‘for each’ activity is not accept datatable but IEnumberable.

use for each row

I have changed to “for each row” and followed your steps. but it did not return the time.

the studio just run the code but shows nothing even I have added log message

it will store in a variable: TimeComp
If you want to print it in message box u can see
Use Message box : TimeComp
U can use it where ever u want it in a workflow

Yes, I know it will store in the variable.

but still no time value after adding message box.
suppose the output panel will show this msg

Excel.xaml (8.7 KB) Test.xlsx (8.3 KB)

1 Like

thank you so much for your helping

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