Remove a certain column from excel

Hi ,

I have a requirement to remove an extra column which is not needed and display the rest

Thanks .

1 Like

hi @Tanu_G

kindly use remove data column activity and give the name you want to remove …and then write the data to excel

1 Like

before this lets say you have a input …get that by reading it to datatable and later use remove data column and next pass the output to write range

You can try with this activity

If you want to delete more than 10 columns or so then prefer going with datatable

Read that excel and keep it as a datatable named dt

Now in that dt use default view to get only the desired column and leave the rest u don’t want

In an assign activity mention like this to get the required columns

dt = dt.DefaultView.ToTable(False, “ColumnName-1”, “ColumnName-2”, “ColumnName-3”, “ColumnName-4”)

Cheers @Tanu_G

1 Like

Hello @Tanu_G

Specify the column to remove
Dim columnToRemove As String = “ColumnName”

Use LINQ to create a new DataTable without the specified column
Dim newDataTable As DataTable = (From col In dataTable.Columns.Cast(Of DataColumn)()
Where col.ColumnName <> columnToRemove
Select col).CopyToDataTable()

Optionally, replace the original DataTable with the new one
dataTable = newDataTable

Thanks & Cheers!!!

1 Like


use remove datacolumn activity to remove the column

before writing to excel


1 Like

Hi @Tanu_G

check this

it Helps!

1 Like

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