Hi ,
I have a requirement to remove an extra column which is not needed and display the rest
Thanks .
Hi ,
I have a requirement to remove an extra column which is not needed and display the rest
Thanks .
hi @Tanu_G
kindly use remove data column activity and give the name you want to remove …and then write the data to excel
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
https://docs.uipath.com/activities/other/latest/productivity/excel-delete-column
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
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!!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.