cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete multiple empty columns in collection?

Shwetavd
Level 4
I have 1000 rows and 200 columns in excel sheet which I am copying into collection (using Get worksheet as collection). Out of 200 columns, around 80 are empty. How should I delete those empty columns? If I use 'delete column' action, it will ask for column name but I want delete all null columns in one go. Please suggest.
3 REPLIES 3

ArchanaSepuru1
Level 3
Use Collection Maipulation ""Get Collection Fields"" Action to get Column Names into a Collection. Loop the Column Names Collection To find weather the Column is completely Empty using ""collection Contains Value"" Action Get the output parameter from the ""collection Contains Value"" action and Make a decision if the output parameter is false then use the Action ""Delete Column"" to delete the particular row. This Logic can be used for collection containing any number of columns.

John__Carter
Staff
Staff
I'd recommend reading the Excel file using an OLEDB query. That way you can actively select the columns you want and ignore the ones you don't. Or in Excel, read across the first data row to identify empty columns for deletion.

Anton__Hosang
Level 5
Another option is to simply write a page in Excel VBO to get only the dataset with columns with values in. The UsedRange of Excel(used in Excel VBO) can have a larger area than the actual data Range.