Select single column of an Excel file as save to DataTable variable

Given the excel file with the data:
col1,col2,col3
1 , 2 , 3
4 , 5 , 6

I just want to extract col2 into a datatable. The following activity instead extracts col2 and col3. How to just extract the col2?

image

@kwoxer

Use Read Column activity to read entire column.

But that gets me back an IEnumable.

image

So how to convert it to an datatable?

I need that type because I want to use the Write Range.

@kwoxer

Ok got. Try below expression then.

  1. First use Read Range activity to read the data from excel file and will give you output as DataTable and say ‘inputDT’.

  2. And then try below expression.

     newColumnDT = inputDT.DefaultView.ToTable(False,"ColumnName")

Works like a charm. Thanks.

1 Like

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