How to copy data from datatable to excel having common column names

Hello UiPath Community,

I have a data in DataTable and a excel file having only column names(No Data) saved in a folder. I want to copy the data from DataTable to Excel having Common column names. PFA. How to compare column names and write Data?

DataTableData ExcelToCopy

Hello, Make sure you have checked "Add Headers " in Read Range and write range activity. Issue resolved.

Hi,
Does Database and excel has same column name? in screenshot screenshot ,it’s different.

Hi @Jyotika_Halai, Yes DataTable and excel have same column name but in addition to same column, excel has few more additional columns. Therefore i want to write the data from datatable to same columns.

Thank you.

I tried your method it will replace all the column names of excel to which i want to write. I want to retain non matching columns as well.

you have to create two data table for both excel file. And then read the data from first datatable and write to another datatable using add data row activity. And keep unused columns blank. You know what I mean.
For better understanding watch this video… How to use add data row.

Hello @Mahesh5491
Please find the sample workflow below to get an idea
ExcelTask.zip (24.2 KB)