RE-Framework Processing Multiple Excel files data one by one

How do we iterate through multiple file in input folder in RE Framework?
Scenario:
INIT state: I am Reading the Outlook mails which has .csv attachments and Storing into an Input folder as below:

image

I need to iterate to each file and process each Item in SAP Application and Add status column and Update the Status for each item based on Business rule and save the file into Output folder with Status per transaction processed.(this Process should be repeating for all file in the Input folder and move the file to the Processed folder once items are processed.

1 Like

@Chiru,

You need to use REFramework with List(Of FileInfo) as transaction data and FileInfo datatype as your transaction item.

I hope you need to do the transaction for the excel as a whole, and not individual rows in each excel.

1 Like

@Chiru,

Check this zip file which has REFramework for files to process one by one, you need to take care of the SAP implementation from Process.xaml.

ProcessExcelFiles.zip (495.9 KB)

For better help share your BRD :stuck_out_tongue:

I mean to say is In Each excel file there are multiple rows for each row i need to do a transaction. and once the Transaction is complete for one excel file and updated the status. then It should take the next excel file and process the Transaction

Csv file one from input folder:

image

It should process all the Items in Excel file and Create a new column next to Quantity and Update the Status as Success.
same way next it should pick the Next file and perform the Transaction for each item.

@Chiru,

In that case you can process all the csv files in the folder as a single file and update the status to a single file for the whole data.

Else you need to write a nested REFramework as

Framework - TransactionData - TransactionItem
Framework1- List(Of FileInfo) - FileInfo
Framework2-DataTable - DataRow

For datatable processing check this link for REframework template for tabular data.
https://go.uipath.com/component/reframework-for-tabular-data

The Tabular data framework you Provided is only for one file with any format either excel or csv. Its not looping through multiple files.

I would not rely on Framework to do everything, use some other logic for example:

  1. Put all rows from each Excel file into one Temp file (that file would serve as my transactionData) (this should be done in Init state)
  2. Add 1 more column to that Temp file that will tell me from which file did the row come (this should be done in Init state)
  3. Then make the rows from that Temp file my transaction items (Get Transaction Data state)
  4. Logic and update status (Process Transaction state)
  5. In the end split and delete Temp file so that I would end up as originally planned (End Process state)

@Chiru,

Check this framework, it has steps to update all the files in a folder and update the status back to the same csv file.

ProcessCSVFiles.zip (76.4 KB)

Thank you.

Thank you so much. Your solution worked. :grinning:

1 Like

@sarathi125

image

when i run my worflow the status is not updating for MaterialCode Duplicate.

The Query you have Provided is for First Index:
There can be duplicate material code also in the Data sheet. I need to Post for all the data including Duplicates.

dtbRecords.AsEnumerable().Select(Function(r, i) New With {.Row = r, .Index = i}).Where(Function(x) x.Row.Field(Of Double)(“MaterialCode”) = Convert.ToDouble(in_MaterialsNo)).First.Index

Can you modify the query?

Status should be updated for Duplicate Records also in the next Transaction.

Provide some valid sample files… Else have two columns combined as a key to get correct row index.

GRSP_Process.zip (58.9 KB)

Please find the attached work flow. I should not consider any Unique values in the Data.

Output should be like below:
image

If any Business rule exception it should update as shown above.

@Chiru,

Check this updated framework, it will move the processed file to a processed file directory. Also update the status based on the transaction item index.

You have to change the Status Text in SetTransactionStatus.xaml for status variable as you want.
ProcessCSVFiles.zip (2.5 MB)

@sarathi125
It works :slightly_smiling_face:
Thank you for taking the time to help me, it really meant a lot.

1 Like

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