How to remove column

practice task 4.1.1.xaml (9.4 KB)
This is the code
How to remove extra column and only display status column

@anjani_priya

Please use remoce data column and give the name you want to remove …and then write the data to excel

Cheers

Why the extra column is added in my code?
can’t I do modifications in the exisiting code to not get the extra column?

Just check your input excel file. Select the column after “Phone Number” and try deleting it manually once from your excel sheet.

@anjani_priya

Looks like when reading excel one extra column is being read…may be becasue there is an extra space or so in that column in excel and it is being considered as data is present

check the same…and delete the column

for safety what you can do is use a filter datatable activity and add the column names which you need and selecct keep…this way if there are extra column read then they would be removed…and only required clumns would be present

Hope this helps

cheers

cheers

Hello @anjani_priya

Assuming you have a DataTable named 'inputDataTable

Check if the “column1” column exists before removing it

If inputDataTable.Columns.Contains(“column1”) Then
inputDataTable.Columns.Remove(“column1”)
Else
’ Handle the case where “column1” does not exist, if needed
End If

Thanks & Cheers!!!

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