distinctdt= dt.DefaultView.ToTable(true,“Department”)=> this will give distinct departments
use for each row activity to loop through distinct departments and inside loop use
filter datatable activity to filter the original datatable dt and provide condition where the department in dt maches with the distinct department
and using write range write the filtered datatable and provide the sheetname as department
In the write range you can use input excel name itself or if you want to maintain a copy …use copy file activity and provide destination file as the output file path and the n in the write range provide output file name