Hi if I clone a datatable, should I be able to write the range and see the headers of the clone table? Having trouble with this activity.
Using Assign: dt1 = dt2.Clone
Hi @dgreen
If you want to store the same dt2 in dt1 then do as below :-
DataTable dt1 = dt2.Copy
And you can use Write Range Activity to Write the Datatable i.e., dt1 to Excel.
Also to read column Headers for that DataTable then you can do below code :-
MyDataTable.Columns(1).ColumnName
Dim name(DT.Columns.Count) As String
Dim i As Integer = 0
For Each column As DataColumn In DT.Columns
name(i) = column.ColumnName
i += 1
Next
Mark as solution and like it if this helps you
Happy Automation
Best Regards
Er Pratik Wavhal
I am ok with Clone as long as it works. What I’d like to know, if clone is successful, I should be able to write the table and see the headers, correct? I am getting an invalid object when trying to use the cloned table so the reason for me wanting to test.