Merging Datatables in excel

I want to merge two data-tables together but when I have tried this they come out as below. Can anyone help please?

hi @j.murphy,

Welocme to the UIpath community !

What is the expected output here -

image


Mukesh

Hello @mukeshkala,

The expected output should be like the first option.

Any advice on how to proceed ?

hi @j.murphy,

I am not sure this if this is the optimum solution - But this worked for me …

So we have 3 DataTable - say dt1 , dt2 and dt3.

  1. we create a Sample excel and Write the Three DataTables into same Sheet from Different Range -
    dt1 from cell A1
    dt2 from cell B1
    dt3 from Cell C1

  1. After This Step my sheet 4 has Data As i Require.

3.Now I again take a Red Range and Read the Complete Sheet 4 in a new DataTable say- OutDT.

image


Mukesh

Hello @mukeshkala,

The ideal scenario is to have the first data table and the second data table side by side in the excel after the merge process.

also when the new data base is written it has to be non - column specific ( next available empty column).

hi @j.murphy,

Apologies for late Response , I missed the post Notification.

So here - If we want the Data to be Pasted side by Side, We will go by the same approach only thing that will change is the Starting cell for the DataTable while pasting.

okay - we paste the first DataTable DT1 from cell A1 - Assuming the excel was blank at begging. So now Lets say if DT1 has 5 Columns - THe New DataTable has to be pasted from E1 .

to Evaluate this E1 - we will read the sheet again and get the COLUMNS Count - This will give us 5 - For 5- we will get the alphabet E and append 1 to make it E1.

Now lets say DT2 was having 2 columns - The Data will Be pasted from E1 to G Column .

Now DT3 should be pasted from G1 - Again we Read the entire Data and get the columns count - Now column count will be 7 (5+2) - We get a alphabet G for 7 , append 1 to it - we get G1. and So on…

Now How do we get alphabet wrt to the Number ?

Below are the threads to refer.



Mukesh

I used a similar approach to get the column count and then used “write range” on the next available column.

Thanks for your help :slight_smile:

1 Like