Error Handling for Worksheet Does Not Exist


I am currently building an automation, a high level overview is that it reads each sheet Workbook A to a datatable and each sheet in Workbook B to a second datatable then compares specific columns and writes out any difference in balances in the columns to a third output datatable.

I need to build in some error handling because currently if a sheet exists in Workbook A but not in Workbook B it crashes with the error “Sheet does not exist”. Ideally I would like to handle this situation by writing the sheet from A that doesn’t exist in B to the output datatable.

Any ideas how I could achieve this?

Hi @TonyR1 - Welcome to UiPath Community.

For the Error Handler of the situation which you have mentioned. Can be handled by the activity “Get Workbook Sheets” (this will return all the sheet names inside the mentioned workbook) using this inside “Excel Application Scope”

Hence you can use above mentioned activity for the Workbook1 through loop pass the sheet name to another Workbook2 Read inside TryCatch, if it throws an error then sheet name of Workbook1 is not available in Workbook2.

I hope this would help your query. If anything needs to clarified then please do reach us.


1 Like

Hi @TonyR1 - Please see attached the sample workflow for your reference.

ExcelSheetMatch.xaml (11.5 KB)


1 Like

Hi Anand
Thanks for support its working for me learn lot here.

Great job

Thanks Anand, that looks useful.
I will try that later on.

Happy to help, my pleasure guys @TonyR1 and @Trivanks_Vinks

Kindly mark this query as resolved.


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