I have two excel files in which 6 columns present in first and 8 columns present in 2nd excel.
In my output excel i need to copy the some column values present in first excel and second excel to this Data Table.
Hi @mettudp075 ,
I think Linq can ok.
but you can use activity
Then follow the steps
1.First add the required columns to first datatable say dt1
2.Use for each row in datatable activity and in the properties add a variable for index
3.Use assign activity with currentrow(“ColumnName”) = dt2.Rows(index)(“ColumnNmae”).ToString
Repeat step 3 for each column you want to add
at the end of loop dt1 will have all the data from dt2 appended beside the data already present in dt1
(From row In dt_plantDetails.AsEnumerable
Let colPlants = (From name In row.Table.Columns.Cast(Of System.Data.DataColumn) Select name.ColumnName).ToArray
Let colArray = (From name In dt.Columns.Cast(Of System.Data.DataColumn) Select name.ColumnName).ToArray
Where colPlants.Intersect(colArray) IsNot Nothing
Let rowArray = (From name In dt.Columns.Cast(Of System.Data.DataColumn) Let value= If(colPlants.Contains(name.ColumnName),row(name.ColumnName),Nothing) Select value).ToArray
Select dt.Clone.Rows.Add(rowArray)).CopyToDataTable
Here dt has 8 columns and dt_plantDetails has 6 columns. If the column names are similar, it will add the values to dt from dt_plantDetails
Maybe you could provide a data table like this one? And Identify there are columns to match?
Like what will be identifier in merging the two data tables.
Do you mean that there is a common column between the two and you want to match them up, like if you had Employee Name and State Abbreviation in one table, and State Abbreviation and State Name in another table, and want one table with Employee Name, State Abbreviation, and State Name?
If so, this is called a join. Use the Join Data Table activity.
Both Tables have same columns names we need to paste the columns values in a new table like Employee1, Location1 from table1 and Employee2, Location 2 from table1 and compare these two values same.
I need to compare the values after running SQL query I got an output from the output i need fetch required column and place in a output excel and From input excel i need to fetch required column and place in output excel file
Note: Both have same columns but some times values will differ if values differ i need to update y in Attribute A otherwise N