Sort the Data in Excel and Create New Sheet with filtered Name

I have an Excel having 46 Columns.
One Column is ‘Department’ columns (with the values like HR,IT,Sales,Marketing etc)

I want to filter the Data Department wise and need to Create Sheets with that Department name with all row data
Departments are dynamic.

Any help would be appreciated.
Thanks.

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

1 Like

Did it work?

Thanks for the Help.

I might be doing it wrong I am little confused can you please provide a sample code of this, would be great help.

Thanks

Can you share the input excel?

Dept_Expected Output File.xlsx (13.1 KB)
Dept_Input File.xlsx (9.0 KB)

Here you go!

Sequence1.xaml (7.9 KB)

Please check this

DT.Asenumerable.Groupby(Function(r) r(“Department”).Tostring).Select(Function(g) g.copytodatatable).Toarray

Output: Array of Datatables

Now Take For each(Datatype : Datatable)

iterate Each Datatable

put Write range inside the for each
path : File_path
Sheet : item.rows(0)(“Depatment”).Tostring
Datatable : item
Add headers : True

did this work for you?

Thanks for This, the Sheet names and the output is correct.
But It’s not Writing the Raw Sheet. I have keep that in output Workbook.

Can you please suggest

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

1 Like

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