Using Linq to filter columns to new sheet

is it possible to copy two column “package” and “completion” to another sheet using linq?
image

Hi @vignesh.maruthappan

Try this

DT1.DefaultView.ToTable(False,{"Package", "Completion"})

Input:

image

Output:

image

Cheers!!

Hi @vignesh.maruthappan

=> Read Range Workbook
Output-> dt

=> Use below syntax in Assign:
dt = dt.DefaultView.ToTable(False, "Package", "Completion")

=> Write Range Workbook dt to new sheet.

Hope it helps!!

1 Like

Thanks @Parvathy if i want to rename the header?

Hi @vignesh.maruthappan,
→ Read the data from the Excel sheet into a DataTable using the “Read Range” activity.
->Use LINQ to query the DataTable and select only the columns “package” and “completion”.
->Write the filtered data to another Excel sheet using the “Write Range” activity.


Here DT is output data table from the read range workbook activity

Thank you

@vignesh.maruthappan

Try this

DT1.Columns("Package").ColumnName="NewPackageColumnName"
DT1.Columns("Completion").ColumnName="NewCompletionColumnName"

Output:

Cheers!!

1 Like

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