Sending exception as one attachment

Hi everyone, I nee help. I have multiple IDs that process through a page along with 3 exceptions, the problem is that the business wants all ID’s with exception in a excel document when the bot is finished is there any way I can do that? If so can someone upload an example?

–create a datatable with build datatable activity and with two columns named source , message
–get the output with a variable of type datatable named finaldt
–followed by this use CLEAR DATATABLE activity and mention the input as finaldt.
–now use a TRY CATCH block and keep your whole sequence where you feel like exception might occur
and in the catch block include this exception type system.exception and inside the catch block use ADD DATAROW activity and mention like this in the ARRAYROW property
{exception.Source.ToString,excepption.Message.ToString} and i the datatable mention as Finaldt

so that it will add the exception source and its reason into a datatable
–then atlast we can use write range activity with that datatable as input and write that to a excel file and send them via mail using send outlook mail activity

hope this would help you

Cheers @seanp92