Hi @Priyesh_Shetty as per your requirement you can set the index at which position you want to add and pass the column name and index parameter as per your requirement
Use the “Invoke Code” activity to write a small snippet of VB.NET code to insert columns programmatically.
Try
Dim todayColumn As New DataColumn("Today", GetType(String))
dtData.Columns.Add(todayColumn)
dtData.Columns("Today").SetOrdinal(1) ' Adjust "1" to set it between "PO No" and "Invoice Qty"
Dim pendingQtyColumn As New DataColumn("Pending qty", GetType(String))
dtData.Columns.Add(pendingQtyColumn)
dtData.Columns("Pending qty").SetOrdinal(4) ' Adjust "5" to set it after "Capex/Opex"
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
Approach 5: Template File
Create a template Excel file with the required columns pre-defined.
Use this template in your automation, which will ensure the structure is maintained every time you run the process.