Copy data from read excel output dt variable into in memory datatable for only matching columns in both tables

First of all, thank you for your valuable time to assist me with this problem! The goal is to copy data from an excel file and add that data to an already created datatable (build datatable activity) but for only columns that have match headers in both excel table and the UiPath in memory datatable.
My current workflow writes all excel columns one next the other and not checking if the column header from the excel datatable matches with the destination column header.
The destination datatable has headers that are exactly the same as my excel column headers and additional columns. I need help to program the robot to skip pasting data into the destination if there is no match column in the excel columns.
I am attaching 3 files here: Xaml, Read_Me_Dt, and Output_Dt files
Thank you again so much I appreciate your help :slight_smile:)REadMe_Data.xlsx (10.1 KB)
ReadMe_Dt.xlsx (10.2 KB)
Main - Copy.xaml (14.9 KB)

I unfortunately don’t have time to look at your uploaded work, but I had an idea that might help solve your problem (assuming I understand your question)

So, idea would be to try using the Merge Data Table activity, and change the MissingSchemaAction property to possibly Ignore? The Merge Data Table basically joins 2 tables together based on the column name… if MissingSchemaAction is set to “Add” it will add the columns that don’t match.

If for some reason that activity isn’t working, you would need to remove the columns in the other table so the columns match up. This is a little more complicated, though.



Hi @ClaytonM!
Yes, Merge Data Table activity worked!
Thanks so much!!