Hi Team,
Can you pls suggest the solution for below query?
I have a column with the departments where i need to filter according to the dept write in seperate excel files
Column
Mech
Mech
CS
CS
ECE
ECE
I need to filter and i need to write mech ,Cs,ece in seperate excel files
Thanks,
Praveen
RajKumar_DC
(RajKumar Durai)
December 15, 2022, 1:09pm
2
Hi @praveenchintu374 ,
Kindly check this
DataTableName.Select("Convert(Column, System.String)< >'"+"Cs"+"'").CopyToDataTable()
Thanks,
Rajkumar
I need to write filtered department data in respective excel workbook…
RajKumar_DC
(RajKumar Durai)
December 15, 2022, 1:17pm
4
Hi @praveenchintu374
Kindly share Eg Input and Output
Gokul001
(Gokul Balaji)
December 15, 2022, 1:17pm
5
HI @praveenchintu374
Use Read Range activity → Store it as Dtread
Use Filter Data Table activity
Check out the image for the reference
Use Write Range activity and pass the output from the Filter Data Table activity
Use Different excel file path.
Regards
Gokul
Gokul001
(Gokul Balaji)
December 15, 2022, 1:20pm
6
HI @praveenchintu374
Check out the skeleton of the XAML file
FilterDept.xaml (7.2 KB)
Regards
Gokul
HI @praveenchintu374
Try like this
use this expression to get the unique departments in another datatable.
Dt.DefaultView.ToTable(true,"Column")
this will get you the dt as
Column
Mech
CS
ECE
loop through this unique datatable.
use filter datatable in main datatable
in filter give like “Column” contains row(0).Tostring
write range the filtered datatable in the sheet name row(0).Tostring and in the excel file name as same row(0).ToString+“.xlsx”
Hope this helps
Regards
Sudharsan
But all the output will be in same excel file
…i need to write in different excel files
Gokul001
(Gokul Balaji)
December 15, 2022, 1:32pm
9
@praveenchintu374
This workflow will filter the MECH , CS and ECE department and write it in the different excel file.
Regards
Gokul
I am not sure what your task exactly is. But here is my project folder that separates mech cs and ece as excel files with their names. I hope this helps you get some idea at least.
departmentSeparate.zip (28.0 KB)
Sudharsan_Ka:
Try like this
use this expression to get the unique departments in another datatable.
Dt.DefaultView.ToTable(true,"Column")
this will get you the dt as
Column
Mech
CS
ECE
loop through this unique datatable.
use filter datatable in main datatable
in filter give like “Column” contains row(0).Tostring
write range the filtered datatable in the sheet name row(0).Tostring and in the excel file name as same row(0).ToString+“.xlsx”
Hope this helps
Follow this updated steps you will get your separate excel files for each department @praveenchintu374
Regards
Sudharsan
departmentSeparate.zip (29.3 KB)
@praveenchintu374 Hi, I think this would be the solution you wanted. This project will read department.xlsx and write each department name into separate excel files.
Best Wishes,
Sara