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.
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.