What I want to do is read the Source File, since I already matched the Headers on my Config File I will just copy the entire column for example Customer ID then paste that to the Account Number in my Template File and so on.
Instead of directly copying the columns better to iterate the each row and paste the data based on the column names.
Here you no need to use the Config file for Header Matching. We achieve this with LINQ Expressions.
Check the below process steps,
→ Use Read Range workbook activity to read the sample Source file and store in a datatable called dt_Source.
→ Use another Read range workbook activity to read the Template file and store in another datatable called dt_Template.
→ Then use the assign activity to write the LINQ Expression,
- Assign -> dt_Template = (From row In dt_Source
Let CustomerID = row("Customer ID").toString
Let CustomerName = row("Customer Name").toString
Let Payment = row("Payment").toString
Let Percent = row("Percent").toString
Select dt_Output.Rows.Add({CustomerName,CustomerID,Payment,Percent})
).Copytodatatable()
→ Then you can use the Write Range workbook activity to write the dt_Template datatable to the Output file.
Check the below workflow for your better understanding, Sequence9.xaml (8.0 KB)