The scenario is like i have a folder that contains aleast 4 to 5 excel workbook . The work book has a standard first name the rest of the name will vary. I need to take the count of the excel workbook then read the data's in workbook's and same it is in diffrent datatable's after each time .This has to be done in Uipath
-
2What you have tried so far ? Please share. – Om Sao Nov 08 '19 at 07:15
-
Could you please be more specific and provide more elaborate questions with maybe examples of the actions you require? – Ilya Kochetov Nov 09 '19 at 16:01
2 Answers
I would recommend you to create this activity as a Library. This is kind of a pattern that can be reused everywhere.
You can find a complete example here. There you can also download it.
To summarize it:
- User
Select Folder
activity ->yourFolder
- Create variable with value
Directory.GetFiles(yourFolder)
->fileArray
- Go through the files via a
For Each fileArray
And if you would like to use it as library, I would recommend you to add those things:
- variable "FilterFileExtentions" to filter for specific files
- variable "NameStartsWith" to filter files starting with specific String

- 3,734
- 4
- 40
- 70
It looks like you are looking to work with files first, to determine which Excel workbook you want to open. To do that you cold get a list of all files in specific folder by using .NET System.IO.Directory.GetFiles method.
So assuming you are working with your project folder you will have an Assign
activity looking like this:
ListOfFiles = System.IO.Directory.GetCurrentDirectory().GetFiles()
Where ListOfFiles
is a variables declared as System.String[]
You could then iterate this array using For Each
activity or get a count of workbooks by using its .Count
property

- 17,988
- 6
- 44
- 60