Do not insert null columns in the data table when merging

Regards!
I have a little problem merging two datatable,
I have a cycle for each that goes through a list of excel files to extract the structured data they contain. When reading the table in Excel, I must accumulate the values ​​in a datatable accumulator. In the first cycle of the iteration everything works fine:

Data from the reading of the first file:
image

Data table accumulator in de first merge:

Subsequently the for each performs the same with the 2nd file, see what happens when you do the fusion:

Data from the reading of the second file:

Data table accumulator in de second merge:

As you can see, when making the second merge, new columns are created in the accumulator data table and fill the columns with null. As I understand this happens when the data tables are not equal in their columns, but in my case if they are equal, the same number of columns with the same names in both the excel files read and in the datatable accumulator.

Anyone have any idea how to solve this problem?

I appreciate your help in advance.

1 Like

Even if you do not see any data in the Excel files, delete all columns of the Excel files after the columns with data. Otherwise, you could specify a specific range in the Excel sheets, you can prevent the data tables from loading null columns.