Hi all.
I have excel file as follows:
I want to get lines with “Role = Builder” but I don’t know how to get them.
Can anybody help me?
Thanks
lamh
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
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
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
@Lam_Ha
If you want to get the value of row 3 then use datatablevariable.rows(rowindex)(columnIndex)
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
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”
Thanks all,
My problem has been solved. thank you very much
Best regards
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.