How to convert IEnumerable to int

i am trying to get data(number) from Excel sheet and trying to use same data in condition

count (excel data)

like J<= Count

Hi @kumar.pfte

welcome to uipath community

I hope you are validating the total row count of the excel with a variable
if thats the case
–then use a EXCEL application scope and pass the filepath of the excel
–inside that scope use a READ RANGE activity and get the output as a datatable named dt
–in a IF condition you can mention as
j <= dt.Rows.Count

Kindly correct if i have understood the query and let know for any clarifications

Cheers @kumar.pfte

1 Like


No i have data in excel below format

each time i need to get row data and next loop condition needs to perform that much No.of time.

Ex:- if i get data B2 by using read row count=2
assign: j=1

condition j<=count (so this loops needs to 2 times)

hope you got my point


in that case, inside FOR EACH ROW loop you can get each row value one by one and assign to count variable like this using assign activity
count = Convert.Toint32(row(“your columnname”).ToString.Trim)
and followed by that a assign activity like this
J = 1

then after that you can use any loop with the condiiton like this
J <= count within FOR EACH ROW activity itself so that each time it will get row value one by one and assign to count variable and the next loop withing for each row will get executed

so the flow will be like


  • assign activity for count
  • assign activity for J
  • any loop like WHILE with condiiton

(all inside the for each row itself)

Cheers @kumar.pfte

im getting below error

my condition

assign i=1 ( first condition needs run for i<=3)
here i need to get data stored in row
(1st row - 20
2nd row - 12
2rd row - 3)
Count = Convert.Toint32(row(“B”+i).ToString.Trim) [“i” means if its running at first occurrence it need to pick 20, 2nd loop 12…]