I Have an Excel sheet with 3000+columns and the starting index is 2
From starting index to 7 columns after that add three columns(“Lesser MOQ Order”,“Final AOG Qty”,“Final AOG Value”) loop wise. (After 7 colums add 3 above columns)
Hi @Melbin_Antu1
Use Insert column activity

Try the below way:
Assign activity: Index = 2
Assign activity: NewColumns = Enumerable.Range(1, ExcelDataTable.Columns.Count)
.Where(Function(i) i >= Index)
.SelectMany(Function(i) If((i - Index) Mod 7 = 0, {"Lesser MOQ Order", "Final AOG Qty", "Final AOG Value"}, {ExcelDataTable.Columns(i - 1).ColumnName}))
.ToArray()
For Each activity: Each column in NewColumns
Use Add Data Column acitivity and column in Column Name and give the datatable name.
Next
NewColumns is of DataType Array(System.String). Index is of DataType System.Int32.
Regards
→ Read Range Workbook
Output-> ExcelDataTable
Input:
→ Use the below syntax in Assign activity:
ExcelDataTable1= New DataTable()
Index= 8
NewColumns= Enumerable.Range(1, ExcelDataTable.Columns.Count).Select(Function(i) If(i = Index + 1, {"Lesser MOQ Order", "Final AOG Qty", "Final AOG Value"}, {ExcelDataTable.Columns(i - 1).ColumnName})).ToArray()
For each currentItem in NewColumns.SelectMany(Function(arr) arr)
-> Add Data Column
Column Name: currentItem.ToString
DataTable: ExcelDataTable1
ExcelDataTable1 is of DataType System.Data.DataTable. NewColumns is of DataType Array(Array(System.String)). Index is of DataType System.Int32.
→ Write Range Workbook
Output:
xaml:
Sequence1.xaml (10.1 KB)
Regards
Please use the code in the below thread and change the Index number value used in the assign activity as per the requirement.
Regards
Or you can use invoke Method.
Add the Column first, then invoke method to change the position.
The index is equal to the column position.
@vrdabberu i used this way no error where found but there is no changes in excel
Can you share the workflow because that code have worked for me. I have attached the supporting screenshots of the EXCEL. Please share your workflow I will try to resolve the issue.
Regards
See the same code worked for me. Please check the workflow I have attached.
Input:
Output:
Regards
@vrdabberu are u tried?
Check the below zip file:
BlankProcess25.zip (30.2 KB)
Make sure to enable macros.
Output:
test (5).xlsx (1.2 MB)
Regards
@vrdabberu Thanks its Working ![]()
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.








