uipathuipath-studio

Add a new Header Row at top of existing Data Table in UiPath


I am struggling with how to add a new row at the top of an existing data table in UiPath. After going through documentations and tutorials related to data table manipulation, I couldn't find much with regards to same or any simple method to achieve same.

I tried few methods at my end but the addition of new row at the top changed the schema. If I create a new data table with just single header row and would like it to be merged with the existing data table such that it gets inserted at top, then how to do that with least number of steps?


Solution

  • Just do it with this line of code dt.Rows.InsertAt(newRow, 0):

    All together: enter image description here

    Build DataTable: enter image description here

    Invoke code: enter image description here

    Output: enter image description here