Simple Stupid, Annoying Task. Two DataTables, add one datatable to another

TWO EXCEL FILES.
Same columns.

image
image

How to Add these together and produce a dt_Final.

There are so many activities here, add range append range add row. So Annoying. I am trying them out and i cant make sense of it for such a simple task.

Please Advice
I Read both these inputs to a DataTable…How to produce a Final One which has all rows from both?

Hi @Hurmet_Noka

Read range the Both Excel suppose Dt1 and Dt2

use if condtion dt1.rows.count>0

Then

Append range the Dt2 Using the Dt1 file path in append Range.

Regards

1 Like

  1. Read Revenue Report
    dt_Revenue = Path.Combine(Environment.CurrentDirectory, locationPath, revenueReport)
  2. Read Cost Report
    dt_Cost= Path.Combine(Environment.CurrentDirectory, locationPath, costReport)
  3. Read Revenue Report one more to final
    dt_Final= Path.Combine(Environment.CurrentDirectory, locationPath, revenueReport)
  4. Append Cost to Final

Result: REVENUE ROWS REPEATED TWICE!!!
DAMN

In the Append Range. I swapped the places of input and output. Your solution works.

Sorry I was stupid!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.