For Each file, If column field value exist, move that file to a new folder

Hi Team,

For Each file, If column field value “LT” exist, move that file to a new folder “Output”

I think got the “If” condition right, but the file does not want to move from the original folder to the “Output” Folder.

Images below.

Thank you

@jaco - You have to change the if condition to, how you have code inside the Read Cell activity…

Because you are saving the LT inside the IF condition…

If that currentrow value(“LT”) then move file…


Thank you, but not all my files in that folder have a LT field. So I want to only move files that have distinct column name in it.

if I place the read cell out of the if statement, an error shows “Could not find LT column” in a sheet.

I removed the read cell activity.

In my condition "Currentrow with column name “LT” (Not variable name)

I am confused little bit now. So your Requirement is to Read the files in the folder and if any files contains “LT” you have to move it to different folder right?? If yes, then why are you reading the excel here…Sorry I am lost here…

No worries,

I need to find the column name LT in an excel file, which is part of many other excel files within a folder.

If uipath can find that excel that contains column name LT within that excel, he needs to move that excel file to the Output folder.

So nothing to do with the file name, it’s the data inside that file it needs to read.

Let me know if I can explain further.

Thanks again

Can you please post some screenshot of the file with the column name LT??

Here is the excel that contains “LT” field. This file needs to be moved to the output folder

and here is the one that does not contain the “LT” field.

@jaco - Thanks for sharing…Will share the workflow in few mins…Hang tight…

Awesome, Thank you.

@jaco - Here you go… (135.2 KB)

This was little tricky. Since we have to read only the column and check the value. So had to add one formula. Plus Instead of move file I used copy file because, since the file is currently reading moving the file will throw an error.

Hope this helps…

Hi @prasath17 ,

Thank you, but I think we are almost there.

I add the template excel file. But when running the bot, only that template was copied over to the “Output” Folder.

I then changed the “Column Count” on the “For each row in Data table” to 100 and ran the bot.

  • Now I see all my excels open and closing, but still not moving the files to the Output folder.

Thanks again

@jaco - (160.9 KB)

I haven’t changed any code, just put more files here and ran. Job ran fine and all the files copies to the output folder. Check the output folder below…


Please run the workflow as is and check…

Checking now

Your workflow worked perfectly, but then I added my files in the input directory and ran the bot again, only your “Files*” are moved over.

Is it possible that the “For each row” .CurrentRow is only looking in excel files with name “Sheet1”? can we have this dynamically(Index 1 of sheets?), as my input files have different sheet names.


This is the new requirement. If you have multiple sheets and we need to include another activity for each sheets before the for each row in datatable…

Hi @prasath17 ,

There is only one sheet in each excel file, but those sheets are named differently.
Does it make sense?

Yes. Question: In each file , the sheet is name is different??

Yes, the sheet names are different.

ok …Let me try…