Data Table to multiple CSV based on value and conditions


I’m trying to automate the building of a data table and then splitting it into multiple csv files based on a column in the table.

Here is a sample of my data.

Sample Data UI Path.xlsx (9.6 KB)

What I want the robot to do is check through the data table for these conditions;

  1. If there is a date in column I that is BEFORE todays date.
  2. If there is only a 0 in column N. (not completely necessary, since if condition 1 is met then condition 2 is always true)
  3. If there is a number leading with “23000” in column R.

If all of these conditions are met, I need it to create a csv file that contains all of the lines for each unique value in column R. So, 2300011111 would have a csv, 2300022222 would have a csv, etc. It needs to only make csvs that meet the conditions above.

What is the best way to do this? A For Each statement? I’m unsure how to set the conditions and then have it loop for each unique value in column R. Any help is appreciated!

Hi there,

Please see the attached file and let me know if it solves you needs.

Main.xaml (7.3 KB)

It works great on the sample data, thank you very much! I was wondering, is it possible to do the same for a generated data table? I get the following error when I am using my data table instead of the read range. My data table is what is used to generate that sample file.


Hi, make sure filtering your DataTable by the column “I” where is must contains some value.

Probably this error is because in certain point the value is empty and than it throws an error when trying to convert it to a DateTime object.

Is there a way to skip over empty values or would it be easier to filter out empty values first?

Yes, you can use the Filter Data Table activity:


“Column8” in this case is the column “I”

Suppose I wanted to convert column “I” from yyyyMMdd into a valid datetime format that the robot can filter by. Is that possible?

I made a slight adjustment to my process and it is working now! I had a few items in the wrong sequence when I moved it from the sample to the project. Thank you so much! This helps me move on to my next step. I need to Filter column R by unique values, save the rows to a csv, and iterate for each unique value in R.

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