Adjust headers in data table


I’m loading excel data into a SQL table using Read Range activity.

Sometimes the spreadsheets headers are spelled differently or missing a character (example: Last_Name is entered Last Name)

Can someone help me adjust the header names properly with logic? I’m guessing that I could maintain a list of values inside a IF activity.

Any help would be greatly appreciated



Hi @timothy.mullady

Does your column headers only contain spaces that you wants to change to underscore “_” ?

To change the first column header name use Assign activity

right side: DT.Columns.Item(0).ColumnName
left side: DT.Columns.Item(0).ColumnName.Replace(" “,”_")

DT is the variable of your DataTable
Item(0) is the first column index

To dynamically replace all column header that contains spaces

  1. store the number of columns > DT.Columns.Count [Int32]
  2. create a list of Integers starting from 0 to number of columns less 1 > Enumerable.Range(1,(number of columns - 1))
  3. For Each activity [typeargument Int32], inside
    right side: DT.Columns.Item(item).ColumnName
    left side: DT.Columns.Item(item).ColumnName.Replace(" “,”_")