I need each folder in the file to pass validation and merge into one excel file after each run.
The thing is I need to use the DU framework however that caters for 1 file at a time.
can someone please guide me on how to build a dispatcher without queue items that will allow me to loop through each file in folder and extract into one excel file.
Hi @Aki1111
Certainly! I can guide you on how to build a dispatcher without queue items to loop through each file in a folder and extract the data into one Excel file. Here’s an outline of the steps you can follow:
Use the Directory.GetFiles method to get a list of all the files in the folder. You can specify the folder path and optionally a search pattern to filter specific files if needed.
Iterate through the list of files using a For Each loop. Set the TypeArgument of the loop to String to represent each file path.
Within the loop, you can apply your validation logic for each file. If the file passes the validation, proceed with extracting the data.
Use Excel-related activities to extract the data from each file. You can use activities like Read Range or Read Cell to read the data from each file’s Excel file.
Store the extracted data in a DataTable variable. If you have multiple files, you can merge the data from each file into one DataTable using the Merge DataTable activity. Make sure the schema (columns) of the DataTables match.
Once all the files have been processed, use the Write Range activity to write the merged DataTable into an Excel file.