How to split an Excel sheet into two individual workbook based on whether it contains specific strings?

I want to split an Excel sheet into two DIFFERENT workbooks based on the condition that a column contains a specific string. In my case, I’m looking at the “school” column. If the value is “ABC high school”, the entire row gets saved to a workbook1, if the value is “XYZ university”, the row gets saved to workbook2. Does anyone have any idea how to do it?

Excel sample:
Book1.xlsx (9.0 KB)

Ideal output:



HI @thedriedseaweed88

Have you tried with Filter Data table activity?

Regards


Give the filter as contain for your specific column as shown in screenshot and use write range activity

Hi,

can you try the following sample?

dict = dt.AsEnumerable.GroupBy(Function(r) r("School").ToString).ToDictionary(Function(g) g.Key,Function(g) g.CopyToDataTable)

Sample
Sample20230927-7Lv2.zip (9.4 KB)

Regards,

2 Likes

Hello, thanks for your reply! For the write range activity, how do I write the output results to a new workbook? Or create a new workbook to write in? Does Studio have this activity?

In write range activity give the file name you want, if file not exist it will create a new workbook file with your given name

Thank you for your help! Your solution worked perfectly

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