How to loop through rows and column in an excel and pass them to a webpage

Hi,

I need to capture data from each row and each column and pass them to a webpage based on column name.
image
So in this example i just want to extract 1st row data and pass them in webpage

like in this table .
So please help me how can i pass a value in this table from excel(row wise)

Thanks in adv!

HI @Riya_Sharma

You need to use For each row in Datatable activity to loop through the rows

Steps

  • Read range activity and store them in a datatable variable
  • For Each row in Datatable
    • Let’s say you want the first column value to be entered in 1st type into activity, You need pass in the text field as “CurrentRow(“A”).ToString” it will get you A column values
      image

So follow for all the columns “CurrentRow(“B”).ToString” and etc so that you can get all the values row wise

Regards
Sudharsan

hi @Sudharsan_Ka ,

Let’s suppose we have 50 rows with defined column then in that how it will work?

Thanks

Use Read range Activity → Read the Input Excel

Store the value in DT

Just Use For each row in Data Table Activity

Pass the DT in the For each row in data Table

We need keep the Type into activity for all the column that you need to process.

CurrentRow(“Column1”).Tostring

Regards
Gokul

If that’s the case @Riya_Sharma

This one type into will loop 50 times and enter the 50 different values of the particular column

Regards
Sudharsan

@Riya_Sharma
You can also check this documentation to know about the for each row in datatable activity

https://docs.uipath.com/activities/docs/for-each-row

Regards
Sudharsan

Hi @Riya_Sharma ,

There is something you can do here, but it will involve making the UI Selection dynamic as well.

First, loop For Each row in DataTable, then nest another For Each which will loop For Each item in ItemArray like so:

image

I am not exactly sure how you are detecting the individual text fields, but if I were you, I would use the Index from the For each itself for the column/row indexes in the UI.

image

Kind Regards,
Ashwin A.K

Hi @Sudharsan_Ka ,

I have tried same but still it’s typing every row data in 1st table only.

Thanks!

Hi @ashwin.ashok ,

It’s typing every row and column data in 1st table cell only.
Because selector is not working for every table cell to typing data.

Thanks!

HI @Riya_Sharma

Try this manually and check for each cell

  • Click on first cell and type something and click on tab button in keyboard and check whether this one imagemoves to next cell

Apologies I don’t remember that blinker name :laughing:

Regards
Sudharsan

@Riya_Sharma This was happening since your selector was not updating for each table cell

If you want the bot to enter the data in each cell then you might gave to pass the row value in to the selector (Called as dynamic selector)

  • First check the selector has row value (Ex: row =2)
  • Pass the row value through variable. Use below link on how to do that
    Dynamic Selectors
  • Increment this variable value once it enters the table cell