How to create excel file with all exception messages?

I built my process using the ReFramework, and exception messages are caught in the try catch.

How do I create an excel file with 4 columns: First Name, Last Name, Age, Exception Reason, and then at the end of each work item from my queue, it will add the relevant information from each item? How do i add new lines, so that after each item, it is added into the same excel sheet but 1 row under (not overridding the information previously there or on the same line)?


Create a datatable with all your required fields i.e. fn ln etc.
In the finally block of your code, you can use the excel scope and write into the excel file using the data table.

Check if the excel is empty before dumping the data. if its empty you can use write range else use append range which will append to your previous data.


@kunalj I created a datatable, and added the excel scope, but it keeps over ridding the previous rows in the datatable with each new run.

How do i get it so that it adds to the next line of the datatable?


You have to read the index of that row first and like below.

         Int index = YourDT.Rows.IndexOf(row)+2

Note: use above expression inside ForEach Row activity and also if the excel data contains headers then it should be +2 else it is +1.

And then if you want to write reason in D column then try like this. For this use Write Cell activity.

Range: “D”+index.Tostring
Value: “Reason”

Execute - Copy.xaml (27.4 KB)

Please checkout the finally block in the attached workflow. Also you can checkout other stuff you can add to your error reporting. Let me know if you have any questions.

hi @happygal321,

it’s fine for the datatable to be overwritten with each new run. It’s only ever meant to be temporary storage of your data.

What’s more important is that at the end of each run you use Excel append range activity to insert the datatable to your Excel in new rows.