Remove Headers

Is there a method to directly remove the headers of a datatable without iterating ?
I tried the remove data row activity with index 0, but it doesn’t work.

When you initial read the sheet or datatable why don’t you read without headers?

I need the headers in the process, but need to remove them at the end.
I could rebuilt the datatable without headers or iterate,but I don’t want to do it that way.
I would rather use a short method. I know the method Datacolumn.ColumnName.Trim but this is only for datatcolumn type not for Datatable.

hi @B.D …Just to understand…So you want to remove the headers and write the output to another file and then use for further processing?

Update:

NewDt = OldDt.AsEnumerable.Skip(1).CopyToDataTable

This query will skip headers and write the remaining rows to newdt. In this way if you want to use the headers you can use Olddt for processing.

1 Like

hallo, yes exactly. I tried your code but it doesn’t work. It can remove other rows but not the headers. I don’t know why.

Do you know how to convert a datatable into a datacolumn ?

It is not possible to remove the headers from a datatable.
If it helps you, you can rename the column names of a datatable to an empty string
I don’t see the point of this but maybe it fits your requirements.

Yes I figured. But you can remove headers from Datacolumn type. Do you know a method to convert datatable into Datacolumn type ?

Do you want to give us more information on why do you want to remove the headers from a datatable? Where do you need to use it?

I’m copying the datatable to a excel sheet, where I don’t need the headers.

In the write range activity there is an option not to include the headers.

1 Like