Adding Headers to existing datatable from header excel

hi i have a header file(xlsx) with all the headers into it and now i have another datatable with the data into into it . now i need to add the headers to the datatable which has a data into it. how can i acheive this in uipath

1 Like

Hey @vishal_nachankar

You can just read the two data tables & Merge it !

Also read/write both without headers into a new Excel.

Thanks
#nK

it is not working i read the headers excel in dt1 and another dt2 which is csv file and tried to merge Dt1 and dt2 the columns of dt1 got added at the end of the final dt

1 Like

When you say dt2 as csv is it tab separate or comma separated ?

Also, please share those files here if possible.

Thanks
#nK

it is | pipe seperated i cant share the files sorry

1 Like

do you mean sth like this? do both files have same # of columns?
image

yes both files have same no columns

1 Like

use this xaml as an example
basically you loop through headerDt.columns
in each iteration assign
dataDt.Columns(colIndex).ColumnName = col.ColumnName
image

test.xaml (9.5 KB)

Test file


headerFile.xlsx (8.2 KB)
dataFile.xlsx (8.3 KB)

Result (written to dataFileNew.xlsx)

You can please share a simulated sample files.

Thanks
#nK

thanks it works

2 Likes

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