Files and Categories

Hi,
I am a new UI Path user.
My problem:
I have a file named Students. This file contains images of elementary school students and high school students. Each image has a different name.
AND
I have an excel with two columns. The first column has the name of each image that is under in the Students file and the second column has its category(Example Elementary School or High School).

How can I let Uipath open excel, read each row, and depending on the name of the image and its categorization to move the image from the Students file to its categorized file: Either High-school folder or Elementary Folder.

To reiterate:
I have a folder name thats called Students, and want all the images under it to go either in the Elementary folder or High-school folder. It all depends on each images category which can be found in the excel file.

Thanks,
From a new User!

@Asoom Does you really need to open excel for this work?
You can Read Your excel data in close excel.
In Uipath Activity Panel Type Excel & Search . You will see all the activities related to excel.
In Excel Activity Scope you can add activities related to read excel range .
In Uipath Academy Foundation Level Excel lessons have a exercise similar to this scenario.

1 Like

Hi,
Sorry, when I said opening the excel file I meant reading the file in general.
My main issue is after reading in the excel range how can I let Uipath remember each image’s name and its categorization and then let it go to the Student’s file and move the images to its categorized file?
I could not find an example online for this. I found a lot of how to move files but nothing similar to what I am doing, which is moving files(images) to its required file depending on its category which is found in excel.

1 Like

@Asoom,

use joins

take image’s nama and categories as one DT1 and Student’s file data as another DT2. based on common or present values you can move data/values.

1 Like

I suggest you go through the UiPath foundation training first as that will clear a lot of your doubts. Otherwise, share your input files here for others to better understand and resolve your problem.

2 Likes

Hi @Asoom

This can be done and rather quite easily. All you need to do is to load your Excel into a Data Table, then loop through all rows and create your dictionary structure when the key is the name and the value is the category.

Then, you need a list of file names from the original folder. For each file, you check which folder it should be copied to and then do the copying.

Please see attached project for a proof of concept. I used simple txt files, but it should work just as well for any images, as long as the names from Excel files match 1:1 with those on the harddrive.

You can build on top of this solution if you wish to add additional security checks → checking if file was properly copied, etc.
SortImagesToFolders.zip (17.8 KB)

1 Like

Thank you for your input. I am currently watching the training and learning as I solve my small fun project.

1 Like

Thank you loads! I am having errors when I run the sequence. Is it becuase I am using a commercial version?

It is probably because I am using the Beta version of the Community Edition.
Could you try to reinstall the package that contains the Data Table activities in your version of UiPath Studio? It is the For Each Row activity that gives that error.

It should be this package: UiPath.Core.Activities