Copy excel columns to another excel with different positions

Hello!

At first, I’m really sorry for my English. I’m gonna try my best.
I’m new to UiPath and VB and need some help.

I got an Excel file with a table in it.
I wanted to copy it to an existing formatted excel file, with different positioning.
I think I made the sequence okay, but I dont know how to code the column positions.

Sooo,
I would like the “B” column to be added to F column, AND if there is any data in “A” column then seperate it with an | symbol and add it. (So B and A column to F)
The same with “D” to “A”, add “C” if data exist with |.
And again “F” to “K”, add “E” if data exist with |.

As I said, the new excel file already exists and already formatted so I dont need the headers and I dont want to copy anything else or delete anything else from the other columns we not used.

I tried using AI, but didn’t worked.
Thank you for helping, I hope you could understood my writing :smiley:
If you could help with coding thats enough, but maybe instructing the whole sequence would be great to check myself.

I can give you some guidance but not readymade code. It is your job = your learninig.

Less effective approach:
1/ read existing excel to datatable, dtSource
2/ create new datatable in newformat, dtDest
loop through all records in dtSource (forEachRow)
3/ transform source row to new format, you could use procedure you described above

4/ add row to dtDest (AddDataRow)

endloop
5/ write dtDest to Excel (WriteRange)

Advanced approach:
The loop and steps 3/ and 4/ can be replaced by LINQ query
There are many resources about it.

Cheers