Step 1: Build A Datatable With Exact Headers That You Need Eg. Dt_Final
Step 2: Read CSV Into Datatable in For Each Loop Eg. dt_CSV_output
Step 3: Add Merge Datatable in the Loop. You need to give values as Source datatable as dt_CSV_output & destination as Dt_Final
Use the Assign activity to create a variable that will store the combined data. You’ll use this variable to accumulate the data from each CSV file.
And Create a variable with an initial value of an empty DataTable.
Use For Each Activity to iterate through the list of CSV files.
Inside the for each loop
Use the “Read CSV” activity to read each CSV file. Specify the CSV file path.
Use the Build DataTable activity to create a DataTable with the same structure as your CSV files. This structure should match the number of columns and their names in the CSV files.
Use the Add Data Row activity to add the row of data from the CSV file to the DataTable you created in the previous step.
After processing each CSV file you need to combine the DataTables into one.
Use the Merge DataTable activity inside the For Each loop to merge the DataTable from the current CSV file with the CombinedData variable.
use the “Write Range” activity to write the CombinedData DataTable to an Excel file. You can specify the Excel file’s path and sheet name.