How to remove the second row as column header in Table Extraction

Hi All,

I am trying to extract Table extraction activity and store in data Table. I am getting below as Column-0. I want to delete the first row and make the second row as column headers.

Hi @dutta.marina

Use a for loop with dt.Columns and change type argument to datacolumn

Inside the loop use currentitem.ColumnName = dt.Rows(0)(currentitem.ColumnName).ToString

After the loop use assign to remove the first row as below dt = dt.AsEnumerable.Skip(1).CopyToDataTable

Or use remove data row activity

Hope this helps

Hi,

The following post will help you.

Regards,

@dutta.marina
use Remove Data Row and give it First row

Hi Lakshman ,

I did the same way mentioned however I am getting an error. I had similar issue in my previous code and tried the following u mentioned and it worked .However in this case I am getting the error.

“Assign: Exception has been thrown by the target of an invocation.”


Can u show the output panel SS

@lrtetala

image

@Yoichi

I tried but it did not work.


@dutta.marina inside loop…print values. I am pretty sure its giving error in last column

@dutta.marina
Following post helps you

@raja.arslankhan

This is the values inside for loop.

Hi,

I guess there are some empty cell in the first row.
Can you try to add the following condition of If activity, then assign column name?

ExtractDataTable.Rows(0)(idx).ToString<>""

Regards,

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