I want to pass last row as header

How to pass last row of excel file as a header row.
In addition to it that last row will be always dynamic one.

i have used add data row to get the header row name but its adding into the last line of the datatable. But i want to add the data as initial row as header
@Palaniyappan @other forum persons as well
Thanking you in anticipation

HI @Divya_Sadhasivam

refer to this xaml
Main (1).xaml (9.3 KB)

after you have added datarow…,

  1. loop over the columns of datatable, then for each column assign last dataRow value to become the header by doing
    dt.Columns(col.ColumnName).ColumnName = dt.Rows(dt.Rows.Count-1)(col.ColumnName).ToString

  2. then delete the last row…
    image

Example
image

After
image

Hai @jack.chan … I referred your code but i didn’t get last row value as header, u assigned last row value as header but didn’t pass the value to data table

kindly let me know how to pass last row value as header in excel file.

didnt you already use add data row to add header row to last row of datatable? my sequence converts last row to the header of datatable… …

if you want to update the excel after that just use write range to update it @Divya_Sadhasivam

hai @jack.chan Last row is removed correctly but i didn’t get last row as header in data table, please find the below attached excel

Output.xlsx (8.4 KB)

1 Like

ok, so you want header to be test2,sasas,sad?

image

No, I want header as last row of excel… NewHeader1, NewHeader2,NewHeader3…
image

1 Like

its working for me
output.xlsx (8.3 KB)
use this…
Main (1).xaml (12.2 KB)
just use write range activity and check “add headers” … . … . . .
image

before
image

after

Thank u… it is working for me also

1 Like

ok, pls mark my answer as solution. thanks

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