I’m trying to handle an exception that once one of the sheets in the excel file missing send me an email with the name of the missing sheet how could I do this? When I try it only gives me one sheet but I need to know all of them “the missing ones”
Hi @kalmajhad
You can iterate through the sheet names on by one in a for each loop. Inside the loop, you can can use a try catch block, in which if s sheet is present, it will perform the specified actions, if sheet is not present, the error will be thrown & the control comes to the catch block. In the catch block, you can append the current sheet name to a pre-declared array of missing sheet names.
Hope this helps,
Best Regards.
First use get sheets activity(This is a classic activity…please enable classic(Activitis → Filter → Show classic))
Now it will give any array (A2)
have your sheetnames you want to check in another array say A1
Now A1.Except(A2).ToArray
will give all the mismatched sheets
You can convert array to string using String.Join(",",A1.Except(A2).ToArray)
Hope this helps
cheers