Reading Multiple Excel files from a Folder as Data using REFRAMEWORK

Hi everyone, I’m working on RE Framework. My scenario is i have 8 Excel files in a folder,which I want to process one by one in a loop, Now Iam reading those files using for each and storing the values in Datatable, if 1 file is finished means my bot needs to take another file and it should process , but here i’m able to process it for 1 file, I don’t know how to do it for multiple files. Can anyone modify it share me it will be a great help.

I need the data from each Excel to be read and stored and used in my application, submit and again repeat.

1st excel- read- data stored- data input in ui application- submit - take up another excel

Once one Excel file is finished It should read the next one.

1 Like

@Sanghamitra_Sahoo

You can merge all the excel in one excel and then use it as per your preference.

Hi @Sanghamitra_Sahoo

You can use Dictictory.Getfiles(directory path) to get all the files in that specific folder and then for each activity to loop through each files in the directory and perform the required

1 Like

Just as Lakshmi said, you can use the a ‘for each’ loop. I’d go for a ‘for each file in folder’ and inside the read range activity the excel path would be the file.FullName

Just another tip: you could store all data to a single data table and then send them to a queue before processing the data

But my Requirement is different.
I have to first read file1, get the data , do some operations, put the values in the UIapplication, Submit and repeat the same with the 2nd file and so on.
I cannot merge the data from all the excel files to one.
That won’t work.

I see. If you are doing the same operations with all the files in the folder, then you can use a for each file in folder activity.

If the operations are different, will result in different sequences, and you would have to treat each file separately

Can you please provide me a sample.
That will be really helpful.

Get Transaction Data state in Main.xaml,
-Create Sequence Group.
– If TransactionItem is Nothing then
– assign FullFileName = string.empty.
– assign TransactionNumber = 1
– For Each file in folder, if found file then assign FullFileName = CurrentFile.FullName
– End Sequece Group

  • If Not String.IsNullOrEmpty(FullFileName) then Framework\GetTransactionData.xaml

Go back to the Main.xaml and address to Get Transaction Data state.
You have to create new linkage recursive to Get Transaction Data and new name is FileExists

image

and add new condition before NoData condition

image