Excel Related : Read multiple columns in Excel

I’m very new to UiPath and trying to get a automation done for reading an Excel file and based on that, search through a document archive app. If the document(s) are found email them back to the email address in the 1st column.

My Excel is like below,

How do I iterate through each column for each row and display the values?

Thanks so much in advance.

1 Like

Hey @Vajira_pg,

Welcome to community :slight_smile:

Here the steps for you,

  1. Read the excel into a data table with Excel application scope & Read range
  2. Use ForeachRow to iterate through data table rows
  3. You can access columns from the row variable from foreach

row("Email Address").ToString

Both represent the same.

Apart from these, if you want to iterate the columns.
Inside your foreachRow add another for each by passing row.ItemArray in collection.

Hope this helps.

Thanks :+1:


Hi @Vajira_pg,

In order to iterate through each column you could use the While do activity https://docs.uipath.com/studio/docs/the-while-activity, while in order to iterate through each row, you can use the For Each Row activity https://docs.uipath.com/activities/docs/for-each-row.

Therefore, one possible solution for your issue could be:

readDT is the datatable representing your Excel data,
myColumn is the start column ("for D should be 3) and your current iteration column

The loop ends when myColumn is greater than readDt.Columns.Count

Hope this helps.
Best reards,

Hi @Vajira_pg, Not sure you want to select a single column separately or just want to view row data. I prepared 2 demos:
Demo1.xaml (6.3 KB) inspired by @Nithinkrishna :handshake:, it is an example of his comment.
Demo2.xaml (7.1 KB) using Select method to select the single-column “Email Address” (Change the excel file path and sheet name before run)

Hope it helps :grinning:

1 Like