How can I insert an If condition to check if there are extra columns in a Data Table?

we do see the extra columns with the auto generated name ColumnX

Assign Activity
arrExtraColNames | String() - String Array =

yourDataTableVar.Columns.Cast(Of DataColumn).Where(Function (x) x.ColumnName.toUpper().Trim().StartsWith("COLUMN") ).ToArray()

afterwards you can loop over arrExtraColNames and remove the columns with e.g. Remove DataColumn Activity

1 Like