so i have an excel without a serial number
and i have done some process using DATATABLE
MY question is i want to create a new column (SERIAL NUMBER , S/N) on first column , and i want to do it directly using the original datatable,
any Suggestion guys?
For a Datatable Manipulation, take a Look at the below post using the
SetOrdinal Method :
How to change the ordinal or position of the DataColumn to the specified ordinal or position? Is it possible to reorder Columns? If yes, please share a sample script.
Issue/Query: How to change the ordinal or position of the DataColumn to the specified ordinal or position?
The above scenario is achievable with the help of
Set Ordinal method.
Sample Excel/ DataTable Data: Consider the below data
Launch UiPath Studio and create a sample process.
Ensure to have …
An Alternate would be to use the
Add Data Column Activity and then use
Filter Datatable to arrange the Columns in the Proper order, this would require you to have the prior knowledge of the all the column names.
or using the
DefaultView.ToTable method and using the Column names required to be present in the datatable in the order that is required like below :
For Updating the newly added Column we could use a
For Each Row Activity after the Column Addition and then update the Serial Number Column.
We could also approach a Linq Update.
Let us know if you are facing any difficulties in the above methods.
Hi do you have to download other dependecies for that activities?
i cannnot seems to find the activities
You dont need to install new dependencies for this ,You need to just enable modern design to get these activities
seemslike im using studioX , is there any diffrence , caused i still unable to find it
As you need the S/No to auto incremented right based on row values we can try with the below xaml
Insert_Column_Infront(Autosaved).xaml (6.7 KB)
Okay Do you have Excel Activities in your dependencies because i can find these activities in StudioX as well.
Seems like for some reason it got turned off i will check it again
i can use it now ,
thanks for the new info
hay pravin thank for reply
but i can seems to see the workflow
For that part you can refer the screen shot below!
hi pravin isee that you assign the new column on index 0 , wont it just rename the column and not adding new column?
Sorry i had mistaken with wrong method!
Please refer to the SS below set ordinal method will be good approach!
Any clarification please let me know!
Hi i havetried you suggestion , it works for adding the column , but it needs to interact with the excel first and not the existing datatable
It will create the column in the excel not in the Datatable
yes , it works , but not really as i wanted , because i want to directly interact with an existing datatable, but its good to know the activity u just shared , thank you
i will try pravin suggestion next
I’m bit confused about your query which you shared on both the replies
@pravin_calvin Suggestion too and let us know what you got.
it works like a charm!!
can you please elaborate more
on the invoke method process?
Sorry my english is a bit messy ,
Thank you for your help , its works !! ,
but just not as i want for this workflow
thank youu Gokul