How to find a single Excel file in multiple folders

Hello guys

I have to find single Excel file which available in Folder inside ther folder multiple folders and Excel files is there.

This folder shown in image :point_down:

And i have used this code shown in below image but this code is creating another file and i don’t want that ,

I want find that file and append the data


Hi @suraj_gaikwad
Do you know the Excel file name you are looking for?

If yes, store the name as a string variable, then use “for each folder in folder” activity, and a nested “for each file in folder” activity, use “if” activity to match if current file match the name of your target file

1 Like

Yes, in second image there is name of file end of the code

But scenario is that

After downloading the first excel file and iterate the file and first sequence done

Then bot goes second sequence choose the file like watchlist updated and iterate the data

Den third sequence same proces like this

Four sequence is there.



For this you can use a expression like this

arr_filepath = System.IO.Directory.GetFiles(MainDirectory, “*.xlsx”, SearchOption.AllDirectories)

This will get all the filepath from the main directory and it’s sub directories

Is this the scenario u have now
Cheers @suraj_gaikwad

1 Like

arr_filepath = System.IO.Directory.GetFiles(MainDirectory, “*.xlsx”, SearchOption.AllDirectories)

gives output of files

use this in assign gives boolean

booloutput=arr_files.any(function(x) x.contains(“yourfilename”))

hope this helps

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