2

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

Ilya Kochetov
  • 17,988
  • 6
  • 44
  • 60

2 Answers2

3

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:

  1. User Select Folder activity -> yourFolder
  2. Create variable with value Directory.GetFiles(yourFolder) -> fileArray
  3. 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
kwoxer
  • 3,734
  • 4
  • 40
  • 70
2

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

Ilya Kochetov
  • 17,988
  • 6
  • 44
  • 60