Hello, I’m a beginner and I don’t know how can I get the row index in Excel and for use it as a variable. Can someone explain this to me in detail? I’m working on UiPath StudioX.
Thank You very much
Hi @sullivanne
If you want to find position of the certain value in the excel. Try this:
Excel Application Scope (to open the Excel file)
Read Range (to read data into a DataTable)
For Each Row (in DataTable)
If (row("Column1").ToString = "ValueToFind")
Assign: RowIndex = row.Index
or
Use Vlookup activity to find the position of the value
https://docs.uipath.com/activities/other/latest/productivity/v-lookup-x
I would like to share some video reference instead of code here as you are new and will help u to understand better
Refer this video for how to access excel file in studioX and for many other scenarios
To get the row index of a datatable refer this video
Hope this helps
Cheers @sullivanne
Let us know for any further clarification
Cheers @sullivanne
I wrote a sample for you ,so you can compare it with your code.
Or you can upload your code so I can check it.
ExpenseDeclaration.xlsx (9.0 KB)
Main.xaml (6.9 KB)
Hello, I changed the project, but it shows me the index one less, instead of 5 it shows me 4… Do you have any idea what I did wrong?
Index starts with zero and row numbering starts with 1. If you want the row number then add +1 to the output.
dkll scdvl cdfsllo[pqod ddfc l dqlddwpdox msmd doons dwjod n xncsde fj jx cs dwcsdcss
try this
For Each Row in DataTable
Assign : item("RowIndex") = DataTable.Rows.IndexOf(item) + 1
Hi @sullivanne
(Read_Range_DT.Rows.IndexOf(item) + 1).ToString
@sullivanne
DT.Rows.IndexOf(item) + 1