Remove columns dynamically from a datatable

Hi @radu.spantu

You can first read both excel sheets into separate data tables.
Now, get the column names of the other datatable onto an array as shown in this post

Now, loop through the attributes of the datatable that holds mapping data using a for each row.
Inside, use another for each activity to loop through the array of column names of the other table.
Within it, use an IF condition to see whether the column names are matching. If matching, that means your mapping sheet has the column that you want.

based on the result, use the Remove Data Column activity to remove the unwanted columns from the data table.

1 Like