Read different excel sheets with For each and If activity

Hi all,

currently my sequence is able to only read 1 sheet from the excel with specific conditions. how do I get the bot to read all the sheets in the excel with the specific conditions that I wanted?
my files are here (10.1 KB)

1 Like

Currently you’re overwriting the data in the datable. Try using different data table for each sheet, and then join them, if they have the same structure.

if I create different data table for each sheet, is there a way to combine all the data tables into one in ‘for each row’ activity? for e.g output_dt + output1_dt? is there such coding?

@Popo Refer this Post and download zip file.

Use merge datatable activity to merge all data table


1 Like

Here is your xaml buddy, its resolved
Sample.xaml (18.8 KB)


1 Like

hey buddy @Palaniyappan

it seems that I always have problem opening the file as the activity could not be loaded because of the errors.

I can’t see the sequence in the excel application scope. possible to screenshot the sequence pls. :slight_smile:

if u do know how to resolve the activity not loaded, do let me know ya

No worries buddy here is the file zipped again (10.7 KB)

and heree is the screenshots buddy

  1. 5…

were u able to see now buddy… @Popo

can I also see the variables that was created and the type argument for workbook.getsheets?

yes buddy here you go iits uipath.excel.workbookapplication @Popo

Is that working buddy


@Palaniyappan am I doing anything wrong? it seems theres error at the read range activity. need your help to let me know how to amend. don’t need to amend the xaml file:)

Read Excel File v090519 415pm.xaml (17.3 KB)

Buddy @Popo kindly change the type arguments of for each loop to string that was the issue buddy
like this

Kindly let know if it works

and kindly add a clear data table activity next to this for each row loop buddy @Popo
like this


thanks buddy @Palaniyappan

but when I run the bot, there’s a error “for each: object reference not set to an instance of an object”

I have added the clear data table. let me know if I did it correctly ya. Read Excel File v090519 415pm-2.xaml (27.1 KB)

Keep like this in for each loop input buddy


@Palaniyappan still get the same error buddy

Buddy @Popo inside the for each loop at which activty we are getting this error buddy
Lets sort this out buddy


hey buddy,
it doesn’t shows any error (!) in the for each activity. when I run the bot, it throws out the above error. and it stops at for each activity.

1 Like