Delete empty column without header reference

BEFORE
image

AFTER
image

1 Like

@shruti, Follow these steps,

  1. Read Range - Read excel output to dt datatable.

  2. Assign - Get all column names that has empty rows

Paste the query right hand side and assign it to arr (String Array)

(From col In dt.Columns.Cast( Of System.Data.DataColumn)
Where dt.AsEnumerable().All(Function(x) x.IsNull(Convert.ToString(col.ColumnName)))
Select col.ColumnName).ToArray()

  1. For each - Loop through array with column Names and remove that column from dt

For each item in dt
in body use Remove data column activity set the columnName (item)

Regards,
Dominic :slight_smile:

2 Likes

is this you told if so, column is not deleting

@Dominic
If you will read excel which is having empty columns at the beginning and at the end. then it is fine.
but if empty columns will come between then you will get default column names like column n (where n will be numbers starting from 0,1,2… so on… and so on.

Note - ignore my comment just missed the part to read all empty rows :stuck_out_tongue:

Regards,!!
Aksh

@shruti, Can you post the before and after pics what you are getting now ?

Tested from my side its working as expected !

Regards,
Dominic :slight_smile:

Done bro :slight_smile:

Regards,
Dominic :slight_smile:

no changes in excel sheet

Can you share your xaml file

@shruti, Its really surprising ! I think you have implemented everything perfectly.

Finally confirm your data variable type (it should be a string array).

Note: I couldn’t upload my Xaml due to security concern, else I would have done it before !

Regards,
Dominic :slight_smile:

yes it’s string only :frowning:
okay i will check it once again Thank you

@shruti

find the attached sample for u - Shruti sample.xaml (10.1 KB)

Regards…!!
Aksh

3 Likes

@aksh1yadav, May I know why it wasn’t working before ? Any ideas ?

Regards,
Dominic :slight_smile: