How to remove multiple column data

How to remove only data in the multiple column but not headers of that columns.
How to remove the data from multiple columns

@anjani_priya

Hi

can you provide a sample input and expected output so that we can help

Book1.xlsx (10.5 KB)
name,age,salary column data should be removed but the headers should not remove

can you send sample code

@anjani_priya

Code:

For Each row As DataRow In inputDataTable.Rows
    row("Maths") = DBNull.Value
    row("Total") = DBNull.Value
Next

@anjani_priya

Try this

DT.AsEnumerable().ToList().ForEach(Sub(row) {
row(“ColumnName1”) = String.Empty
row(“ColumnName2”) = Nothing
row(“ColumnName3”) = DBNull.Value
})

@anjani_priya

dt2_Updated.AsEnumerable.Select(Function(r) dt2_Updated.Clone.LoadDataRow({“”,“”,“”,r(3).ToString,r(4).ToString},False)).CopyToDataTable

use this in assign activity

and use write range activity

@anjani_priya

Code:

For Each row As DataRow In inputDataTable.Rows
    row("age") = DBNull.Value
    row("BRANCH") = DBNull.Value
Next

O/P:
Book1 (4).xlsx (10.4 KB)

Please find the below xaml for your input excel file

BlankProcess12.zip (129.9 KB)

Hope this helps!!

without write range it will work?
because I dont want to write the data in another sheet just it should remove the data in the current sheet

code to write in invoke code is
dt_Sample.AsEnumerable.ToList.ForEach(Sub(x)
x(“name”)=Nothing
x(“age”)=Nothing
x(“salary”)=Nothing
End Sub
)

@anjani_priya

It writes within current sheet please look into this

for arguments passing please find below image


error

@anjani_priya

Are you passing the arguments correctly please check


see this
I have created the variable as “data”.

@anjani_priya

dt2_Updated.AsEnumerable.Select(Function(r) dt2_Updated.Clone.LoadDataRow({“”,“”,“”,r(3).ToString,r(4).ToString},False)).CopyToDataTable

Sequence1.xaml (7.8 KB)

The changes should be done in the same sheet

iam getting an error

@anjani_priya

It is working perfectly in my PC

Please try this xaml

BlankProcess12.zip (134.6 KB)

@anjani_priya

Can you show that error