i need duplicate header row in datatable…
for example
date | aaa | bbb | ccc | ddd | eee | fff | ggg |
---|---|---|---|---|---|---|---|
1-3 | 12 | 54 | 25 | 13 | 51 | 56 | 33 |
3-7 | 9 | 3 | 3 | 20 | 4 | ||
Total | 21 | 54 | 28 | 16 | 71 | 60 | 33 |
i need duplicate header row in datatable…
for example
date | aaa | bbb | ccc | ddd | eee | fff | ggg |
---|---|---|---|---|---|---|---|
1-3 | 12 | 54 | 25 | 13 | 51 | 56 | 33 |
3-7 | 9 | 3 | 3 | 20 | 4 | ||
Total | 21 | 54 | 28 | 16 | 71 | 60 | 33 |
@domsmgtmeet22
Please use assign:
new_Datatable = old_Datatable.Copy()
It’ll copy the schema of the source data table only.
only first row on paste second row…
Could you elaborate for your request?
Please try this
' Assuming originalDataTable is your DataTable variable
If originalDataTable.Rows.Count > 0 Then
Dim duplicatedHeaders As DataRow = originalDataTable.NewRow()
duplicatedHeaders.ItemArray = CType(originalDataTable.Rows(0).ItemArray.Clone(), Object())
originalDataTable.Rows.InsertAt(duplicatedHeaders, 0)
End If
Input:
Output:
Note: Uncheck Add Headers option in Read Range and Write Range activity
Regards,