Remove Value based on columns Name


i have a Excel Data in that sheet having many columns is there. so that i want to remove value on Selective column Name.

Input Data:

Expected Output


Hi @Shyam_Pragash
If you want to directly remove columns of the sheet, can you try Insert/Remove columns activity?

if you want to delete columns by name
kindly refer this link


Hi @Shyam_Pragash,
You can delete a column and recreate the same column, so all the value are empty.
use for each row activity loop it
using Assign Activity


use invoke code activity with this

dt.AsEnumerable().ToList().ForEach(Sub(row) row("Col2")="")
dt.AsEnumerable().ToList().ForEach(Sub(row) row("Col4")="")

invoke code arguments:

use this for reference
TestA.xaml (8.7 KB)

if you want to make it dynamic, you can add 1 more variable “columnsToEmpty” then split by comma to an array and iterate over this array

TestA.xaml (10.0 KB)

Hi @jack.chan @arivu96 @nikhil.girish

Thanks you alll…

i got the soluation.

Shyam :slight_smile:

1 Like

Hi @Shyam_Pragash ,

Maybe this is an Alternate Solution, where we deal with only the Columns, instead of Updating the all row values of that Column :

  1. We would first have to Get all the Column Names from the Datatable as an Array of String. This would be used later for Ordering of the Columns.
columnNamesArray = DT.Columns.Cast(Of DataColumn).Select(Function(x)x.ColumnName.ToString.Trim).ToArray
  1. Next, we create a Array of String, which contains the Columns that need to be Removed using an Assign Activity
columnsToRemoveValues = {"Quotation Ref"}
  1. Then, we Remove the Columns specified in columnsToRemoveValues from the DT and we add them again and Order the Columns using Assign Activity. The Ordering is as of the Original DT Columns.

  2. Next, we write the Datatable back to the Excel Sheet using Write Range Activity.

Find the Example workflow Below : (10.3 KB)

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