Convert departments to sheets in uipath give the flow

Employe Depatrment
Ram HR
Shyam FINANCE
Kumar HR
Yashin Accounts

convert departments to sheets in UiPath give the flow

1 Like

@Balagola_Bharath_Kumar

Can you please elaborate a little

Cheers

1 Like

Hi

Hope the below steps would help you resolve this

  1. Use a assign activity like this

List_sheet = {“ Employe Depatrment”, “Ram HR”, “Shyam FINANCE”, “Kumar HR”, “Yashin Accounts”}

Where list_sheet is a variable of type System.Generic.Collections.List(of String)
And initialise with default value as New List(of String) in varibale labor

  1. Now use a FOR EACH activity and pass above list as input and change the type argument as string

  2. Inside the loop use either a WORKBOOK WRITE RANGE activity where pass a new excel file path and sheetname as item.ToString
    Or
    You can use INSERT SHEET activity with sheet name same as above

https://docs.uipath.com/activities/other/latest/productivity/insert-sheet-x

This will create a workbook with all the above sheet names

Cheers @Balagola_Bharath_Kumar

1 Like

lets assume we want to group by all rows by the departement and split it to different worksheets we can do

Grouping the data:

e.g.

Assign Activity:
TableList | List(Of DataTable) =

(From d in dtData.AsEnumerable()
Group d By k=d("Department").toString.ToUpper.Trim
Select t=grp.CopyToDataTable).toList

For Each Activity | tbl in TableList | TypeArgument: DataTable

  • Write range Activity:
    DataTable=tbl,
    SheetName = tbl.Rows(0)(“Department”).toString.Trim
1 Like

Hi @Balagola_Bharath_Kumar

To convert the list of employees and their respective departments into separate Excel sheets using UiPath, you can follow this workflow:

  1. Read Data:

    • Use the “Read CSV” activity to read the data from your source, which appears to be in CSV format.
  2. Group Data by Department:

    • Use a Dictionary or another data structure to group the data by departments. Iterate through the CSV data and organize employees into their respective department groups.
  3. Create Excel Files:

    • For each department, create a new Excel file or a new sheet in an existing Excel file.
  4. Write Data to Excel Sheets:

    • Loop through the department groups and write the employee data to the corresponding Excel sheet.

Thanks!!

1 Like

Hope it’s clarified @Balagola_Bharath_Kumar

Not sure , lets check and conform

1 Like