How to open excel file one by one in a folder?

Hello Community,
I need assistance. I have a folder and it’s in few excel file like Nancy_robot.xlsx, Angel_robot.xlsx. Now I want to open excel file one by one and select column C. Please any one can help me. That Will be best if you upload code.


1 Like

What you going to do when u had selected the columns?


   varStrFiles [] = Directory.GetFiles("FolderPath","*.xlsx")

The above expression will read all Excel files from that folder and will give output as array of string. Then use For Each loop to itreate one by one file.

ForEach item in varStrFiles
Excel Application Scope
use Read Column

To know more about Read Column Activity then please check below thread.


Thanks for your explanation.In my folder .xlsx file have more. Please let me know I need to open few required excel file one by one.Which every file name ends with anything_robot.xlsx. like anna__robot.xlsx, angel__robot.xlsx this type of file I need to open. Please give me the solution.

First assign an array to get all files

array[string] abc = directory.getfiles(“folderpath”,"*.xlsx")

Then use for each activities with open excel application scope to open each of them

For each item in abc

the path of open excel application scope is using item

Hi @Jesmine,
Please check this workflow i kept 2 files in the folder and opening them.
Looping (28.2 KB)
If you find useful mark it as solution.

1 Like

Hello, @Vashisht can you tell me that I have done it using for each activity. But I have another for each activity, which in activity I want to use it.
When matching the item In another for each activity Bot open hole excel file in folder. It should be one item match then one excel file open. Then another match after that another excel open.
Now I need to solve this.Please take care it.

Sorry i did not understand your question. Can you explain in simple way or xaml file?

@Jesmine: Please find the attachment. Hope this is what you are (31.3 KB)

1 Like

Thanks @lingamg , but its I have done before. Please check my code on for Now I am not able to upload here because I am new. Have any email?
I need open single *_robot.xlsx file when matching 1st condition. again matching 2nd condition then open another_robot.xlsx file.
Note: In your code open hole file together like *_robot.xlsx file in folder. lease give me the solution as well as.

I am not able to upload any attachment because I am new user in community. Have any email?

@Jesmine: Upload option available in the reply itself

Please find the attachment

Hi @Jesmine you want to open excel files one by one from the folder, right.
so, do like this-

  1. Take an assign activity----> excelFilePath=Directory.GetFiles(“your file path”,"*xlsx")
    Note: the excelFilePath variable should be String type.
  2. Take one forEach activity and pass this variable (excelFilePath) and take ExcelApplicationScope activity inside the ForEach activity and instead of file path give like this- item.ToString
  3. Inside that ExcelAppScope activity take one Read Range activity of Excel
    and now definitely you will able to open each excel file one by one…try like this
    Main.xaml (8.8 KB)


@lingamg I know it.when i upload show me the massage. image
How can I send you the code?

Thanks @kumarD. I have done it. I need to use it in for another 1.ForEach activity. So when I use it in another 1.ForEach activity. when satisfy first 1.ForEach activity then open all robot.xlsx file in folder together. Again go to 1.ForEach and if satisfy it then check 2.ForEach activity if it satisfy then open another robot.xlsx file. Hope you are understand.
I want to share my code but I am not able to upload for new user.It’s uipath guideline. How can I share with you my code?

ok i got it. so, you can share screen shots, i think that will also very helpful…

@kumarD thanks,
Not upload one more image for new user.
Please check and anything need?
then knock me the gmail to angel.nancy.ra91

Hello @kumarD @lingamg
Have any update?

Hi, Good Morning @Jesmine
I can’t understand that what you wanna do, what is your requirement?
So, can you please explain to me again…
And another thing is, in your screen shot you taken a assign activity to get all the excel files from the specified folder and you stored in a StringArray variable. Till this you did correctly but on the next step you taken a ForEach Row activity, here i didn’t understand why and inside the IF activity you used a ForEach activity, again here i didn’t understand that also why?
So, kindly explain to me in simple words then i may help you…!



Thanks @kumarD ,
I want (step1)first condition matching then open(step2) “*robot.xlsx” again (step1) 2nd condition matching (step2)open another “*robot.xlsx”.
Please check my (71.5 KB)
If I will get the solution from you that is very helpful for me.