Merge 2 different Excel In 1st excel

Hello,

- This Excel 1


This Excel 2

I want to merge these 2 Excel in Excel 1 like


How can i do this?

hello @HELZMOTH_BJ ,

Firstly, you need to find last row of excel 1 by using - dt.rowcount
then you need to use write range in excel 1 with datatable of excel 2 and give range - “A”+(dt.rowcount+1).tostring

let me know if this works.

Cheers!

@HELZMOTH_BJ,

If there is no logic to be checked just concat as it is, you can use below approach

  1. Read Excel 2 data using Read Range workbook activity.
  2. Use Write Range activity to write the step 1 datatable in to Excel 1 at the end cell of the range. As per screenshot, you should be providing range Q1. Also add headers property should be checked.

Can you please provide xaml


Your output look like this but i wan to add the dt2 from last column and copy the dt1 value to rest of the rows

Got you,

Here’s the Xaml containing logic as per your requirement, Let me know if it works.

BlankProcess2.zip (16.5 KB)

Below are 2 input excel

excel 1.xlsx (8.9 KB)
excel 2.xlsx (8.8 KB)

Regards.

2 Likes

@HELZMOTH_BJ

You just need to read Excel 2 and use write range with the range as the first cell where the data needs to start in excel 1

cheers

This work but i also want to copy the 1st row of excel1 till column Service_Period until it reach empty row.

You should create other thread for this as it will be easy for other user who will see this post in future.

Assumption:

  • side by side merge of Excel1 and Excel2
  • Repeat / fillup Excel1 rows for Excel2, when Excel2 Rows count greater then Excel1

Variables:
dtMerged | Datatype: DataTable

Flow:

  • Read excel1 with read range → dt1,
  • Reade excel2 with read range ->dt2
  • Assign Activity: dtMerged = dt1.Clone()
  • Merge DataTable Activity: destination: dtMerged | source: dt2.Clone()
  • Assign Activity:
    dtMerged =
(From d1 in dt1.AsEnumerable
From d2 in dt2.AsEnumerable
Let ra = d1.ItemArray.Concat(d2.ItemArray).toArray
Select r = dtMerged.Rows.Add(ra)).CopyToDataTable

then write back dtMerged to an Excel / new Worksheet