Get data from any row in excel file

Hi all.
I have excel file as follows:image
I want to get lines with “Role = Builder” but I don’t know how to get them.
Can anybody help me?
Thanks
lamh

1 Like

Hi @Lam_Ha
Follow the Following steps.

  • Read the Excel file using read range and store it in Variable suppose dt.
  • Use for each row To read the data table row by row.
  • Get the Value of Row using row(“Role”).ToString and store it in RowValue variable
  • Below that use If Condition And give RowValue= “Builder”.
  • Inside the then Section Of the If Activity Perform the operations Which you want to perform.

Thanks & Regards

1 Like

Thanks @jitendra_123
but i want get data follow row index.
you can help me get data follow rowindex?
best regards

Hi
hope these steps could help you resolve this
–use excel application scope and pass the file path as input
–use read range activity and get the output with a varaible of type datatable named outdt
–use a for each row loop and pass the above variable as input
–use a if condition inside the loop mentioning like this
row(“Role”).ToString.Contains(“Builder”)
if the condition passes it will go to THEN part where we can get the row index
like in a write line activity
outdt.Rows.IndexOf(row).ToString

Cheers @Lam_Ha

@Lam_Ha
Do you want the data of the row which contains “Builder” If yes
Then Follow the above steps and in The Then section Of If Condition.

  • Get the Employee Using row(0).tostring In Employeee Variable.
  • Same way Get the Location using row(1).tostring In the LocationValue variable.
    And if you want to add these value as row in data-table then use Add data row activity and in the array row Give this variables as a array.
  • So it will give you the data of Row which having the value of Role as Builder
1 Like

thank @Palaniyappan, @jitendra_123
if i want get data from any line eg: line 3,5,6,8,9,11.
How to do it?
please give me example
Best regards

1 Like

@Lam_Ha
If you want to get the value of row 3 then use datatablevariable.rows(rowindex)(columnIndex)

1 Like

its very simple buddy
if we want to get the data from any line like any row from the datatable
we can mention like
yourdatatablename.Rows(yourrowindex)(yourcolumnindex)
or
yourdatatablename.Rows(yourrowindex)(yourcolumnnamebetweendoublequotes)

where both the row index and column index starts from 0 for the first row and first column

Hope this would help you
Cheers @Lam_Ha

3 Likes

thanks @jitendra_123, @Palaniyappan
I will try it :smiley:
Best regards

1 Like

Great
Cheers @Lam_Ha

change the excel path and “dt1.Rows(2)(2).ToString” ,“dt1.Rows(4)(2).ToString”,“dt1.Rows(5)(2).ToString”,“dt1.Rows(7)(2).ToString”,“dt1.Rows(8)(2).ToString”,“dt1.Rows(10)(2).ToString”

1 Like

Thanks all,
My problem has been solved. thank you very much :smiley:
Best regards

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