How to filter an excel file and create a new file with the filtered data?


Hi Experts,

I need a help for how to filter an excel file and create a new file with the filtered data?

Any suggestion?


Hi, @Andres_garcia

You can use “Read CSV” or “Excel Application Scope + Read Range” to read your excel file details.
Normally if I want to filter and create new file, I will use the “Build Data Table” activity.


You can get the row item value then add “IF” statement inside for filtering.
Then, use a “For Each” activity to loop thru your excel data.


You can use “Write CSV” activity to create new file.



Can you explain what kind of filters you want to apply for the excel file?


Hi @ hemanth_chinna,

I have a file with 7 users, each user has one row of data with different attributes, I want to extract each of the users from the original file and create a new file for each one of them with only their corresponding data.

This should be on an excel file.



pls find sample filter.xaml (7.1 KB)
xaml .

After this Xaml. You can write the filtered data in Csv File


I would recommend instead using LINQ to select distinct over column 1 to get an IEnumerable<>. This will give you each of the users in the table. EDIT AGAIN: Forget this part, it’s easier to

Next, use a for each over that IEnumerable<> you just created and use LINQ again to filter out the table based on each username and save it to the new excel file named after that username

EDIT: I forgot to add that UiPath has a LINQ example of a simple filter already in their Samples–>Advanced library if you need to see an example

2nd EDIT: Thinking about it again, there’s a much easier way to get the list of distinct users. You can instead use YourTable.DefaultView.ToTable(TRUE,“UserNames”) to build a new table showing only distinct usernames from YourTable. Then iterate over this using LINQ as mentioned above