Convert a row into header in a datatable

I want to convert a one whole row into header. I used a Extract Data table activity, there it extracts header as row element and gives header as “Column1”…and so on. I want to convert a row into a header. I tried renaming using for each loop but looks like it will consume more time if there are many columns.


Header will be always first row of the Datatable

If you want then in Read Range activity enable Add Headers in properties, So first row of the excel sheet will act as Headers

Hope this helps you


Hi @Rajat_16
While writing the datatable to excel file using write range do not tick add headers options

Then the first row will become as header in excel file

Hope it help you

Mark it as solution if you got it


Nived N

Happy Automation

Don’t we have any other function in the datatable to replace column / rows with header?

Hi @Rajat_16,

You can do this in another way

  • Loop the first row using For Each activity
  • Then Assign dt.Columns(columnIndex).ColumnName = firstRow(columnIndex) this will rename the header
  • After the loop delete the first row