Read multiple sheets for multiple excel files

hi guys, i’m trying to read multiple excel sheets in multiple excel files, for now i just want to print the result (sheets name) but i always get an error “Object reference not set to an instance of an object."

the first foreach works fine, the error is on the second foreach when i try to print the sheets
any suggestions ?


Have you created variable of type workbook for Excel application scope activity and also check whether you passed variable type properly or not for second for loop.


if you want to get the excel sheets you can use this activity excel sheets

actually i want to loop each of the sheets because later i want to validate the sheet’s name

i think i has, could u check it for me
Main.xaml (11.8 KB)


I checked your workflow and found you did not change type argument for both for loops and by default it will be Object and we have to change it according to our input type and also we have to create workbook for variable for Excel application scope activity and then use GetSheet method to get all sheets from that excel file.

I modified your workflow and please find the same.

Main (8).xaml (12.3 KB)

If this solution works for you then close this thread by marking it as solution.

1 Like

it works, thanks for your help !

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.