# Combining excels

**URL:** <https://forum.uipath.com/t/combining-excels/722449>\
**Category:** StudioX\
**Tags:** excel-automation, datatable, data, studio, excel, activities\
**Created:** [February 26, 2024, 11:00am UTC](https://forum.uipath.com/t/combining-excels/722449 "2024-02-26T11:00:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![khaled\_emad](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/khaled_emad/32/274207_2.png) [@khaled\_emad](https://forum.uipath.com/u/khaled_emad)\
**Post date:** [February 26, 2024, 11:00am UTC](https://forum.uipath.com/t/combining-excels/722449/1 "2024-02-26T11:00:48Z")

</div>

I have an excel sheet with 8 columns (1-8).  
I need to take the data of column (1-3-4) and append them to another excel sheet with new columns header  
How can I add take these columns value from my data table and append them in correct location

thanks

---

<div class="post-metadata">

**Author:** ![rlgandu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rlgandu/32/488436_2.png) [@rlgandu](https://forum.uipath.com/u/rlgandu)\
**Post date:** [February 26, 2024, 11:02am UTC](https://forum.uipath.com/t/combining-excels/722449/2 "2024-02-26T11:02:18Z")

</div>

@khaled_emad

```auto
newDataTable = sourceDataTable.DefaultView.ToTable(False, "Column1", "Column3", "Column4")

```

 ![image](https://global.discourse-cdn.com/uipath/original/4X/4/f/c/4fc0df2741623b7d6d759ac1d44b96212e1767ba.png)

If your Column names are equal in both source and daesination then merge datatable activity works.The three column names must be equal .If your destination contains n number also it can work.

---

<div class="post-metadata">

**Author:** ![vrdabberu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vrdabberu/32/484365_2.png) [@vrdabberu](https://forum.uipath.com/u/vrdabberu)\
**Post date:** [February 26, 2024, 11:06am UTC](https://forum.uipath.com/t/combining-excels/722449/3 "2024-02-26T11:06:32Z")

</div>

Hi @khaled_emad

```auto
arrColumnName = {"Column1","Column3","Column4"}

```

```auto
dt = dt.DefaultView.ToTable(False,arrColumnName)

```

Regards

---

<div class="post-metadata">

**Author:** ![pravallikapaluri](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pravallikapaluri/32/484755_2.png) [@pravallikapaluri](https://forum.uipath.com/u/pravallikapaluri)\
**Post date:** [February 26, 2024, 11:08am UTC](https://forum.uipath.com/t/combining-excels/722449/4 "2024-02-26T11:08:28Z")

</div>

Hi @khaled_emad

Read the Output excel in out\_dt.  
Read the input excel in dt.  
for each row in dt  
Add datarow for out\_dt  
In the Array you can give {currentrow(“column1”),currentrow(“column3”),currentrow(“column4”)}  
Write Range workbook

 ![image](https://global.discourse-cdn.com/uipath/original/4X/c/4/3/c434a600eb30163d01315b022a33f0e2fbdf88c2.png)
