I read excel by using read excel and stored data in datatable, now i want to change the datatable column sequence. Please give solution.
Hi @AmolS,
I believe that in your case you could iterate between those columns and reorder their sequence by using an index array and a for each loop like the example below:
Hey @AmolS
please find this attached sample solution(For demo)customized it as per your need if required and let me know
Sample Solution.zip (5.9 KB)
Regards…!!
Aksh
Thanks Akshay…!
I edited your code to write the modified data table in the excel sheet. The values are being modified in the same order as in the output panel. But how can I change the column names as well?
You can use a simple Assign activity with the following code:
yourDataTable.Columns(0).ColumnName = "New Column Name"
or
yourDataTable.Columns("oldColumnName").ColumnName = "New Column Name"
You can use a simple Assign activity with the following code:
yourDataTable.Columns(0).ColumnName = "New Column Name"
or
yourDataTable.Columns("oldColumnName").ColumnName = "New Column Name"
Okay, thank you.
Thank you.