How to insert a column between two columns in excel using activities without using send hotkey ?
Hello!
You can use “Read Range” activity to read all the content and fill a DataTable. After this, you can use “datatable.Columns(ColumnName).SetOrdinal(columnPosition)”
Example:
It will move the column “NewColumn” to position 3.
Hope It Helps
Regards,
Thanks for your reply
but it is giving error as expression doesn’t produce a value.
could you please elaborate answer or share screenshot …
Try this
Thanks for your reply Akshay. In the above link you are trying to modify the data table(swapping columns).But I want to insert the new column in 2nd index.
add column to datatable and then use invoke method activity to set ordinal of the column as in example.
It is not possible set ordinal while inserting a column.
- insert column
- set ordinal of column
A ton of thanks for you and Lucas !!!
It worked for me !!!
Could you please tell the target type, target object and method name you selected that worked?
the answer to this question is in the ff. link . just sharing for future readers.
But this is not working for me it i s Showing bellow error, will you please help me in it.
Try to use the same command but inside the “Invoke code” Activity