I started to use for each and assign
Use read range to read all the cells into a datatable
then use write range to write the data in another excel file
If this has helped you, please mark this answer as the solution.
Hi @Soudios,
Use read range activity to read respective range and then use write range activity to paste it another excel.
@ermanoj3101
but if i need to past many cell but not with same position
Did i need to use many write cell ?
Then you can define it in Range from where to where you wan to paste it.
And if you want to paste rows on the basis of some conditions then use foreach row and iterate each row and paste it wherever you want.
i need to copy cells not rows because cells postion name in excel 1 have different position in excel 2
Can you show me through the screenshot or if you want to share excel with input and output you can send that to me so that i can i have a clear picture what you want ?
Thanks.
Excel 1 :
I need to copy the information from excel 1 to excel 2 but the sequence is not the same, i can’t just copy past the row
Excel 2 :
Is their two columns with same name i.e “Name3” or you have missed Name4 ?
If it’s Name4 then it can be done through linq, please first confirm it’s “Name3” or “Name4”
Yes i just missed Name4
You can use below query it will change the sequence of columns.
So the question should be asked as "Can we change the sequence of column ?
(From r In dtInput Where r.Item(“Department”).Equals(“IT”) Select dtOutput.LoadDataRow(New Object() { r.Field(of Object)(“Name3”),r.Field(of Object)(“Name1”),r.Field(of Object)(“Name4”),r.Field(of Object)(“Name5”),r.Field(of Object)(“Name2”) },False)).CopyToDataTable
Thanks.
Non we can’t change the sequence in Excel 2, but the screen its just un example, the columns do not always follow each other
My question is if i can do the same than using assign and write cell for every cell or there is a fasted way
Not sure, i thought you want this as result and that is what you have shown in your screenshot…
Maybe someone can help you.
Thanks.
Read into a datatable. Reorder the columns in the datatable. Write to Excel.
how can i reorder the columns ?
Check out this for reordering and renaming datatable columns:
3 posts above mine, ermanoj3101 told you how to reorder them. Well, one way anyway.