I have to remove blnak header columns (without knowing index)

I have to remove blnak header columns (without knowing index)

Thanks
Shaik Muktharvalli

Read Range just the first row (don’t check the Add Headers box). For Each in yourDT.Columns (set TypeArgument to System.Data.DataColumn). If yourDT.Rows(0)(currentColumn.Name) = “” Then Excel Delete Column

Hi @postwick

Can you give sample workflow please

Hi @supermanPunch

Can You send sample workflow please

Hi @shaik.muktharvalli1

Can you try this once

Hope this helps you

@shaik.muktharvalli1 ,

Could you check the below Workflow :
Excel_RemoveEmptyColumns.zip (10.3 KB)

The above workflow performs the Reading of the Excel sheet as a Datatable, Performs fetching of the Columns from it and Detects which column values are all empty and gets the Column Position.

We then Loop through the Column Positions found and use Insert/Delete Columns Activity to delete the column directly in Excel.

This was done as assumed the Task is to Delete the Columns from the Excel Sheet.

Another way around, would be to remove the Empty Columns from the Datatable and making the Whole Excel Sheet as empty using Write Cell activity and then Writing the updated datatable back to the Sheet.

Its deleted whole data

can you show…for each type argument and arr_column variable type?

@shaik.muktharvalli1 ,

Did the sample workflow provided not worked for the Sample Data present in it ?

FOR EACH TYPE of ARGUMENT is DataColumn

Array type is array(DataColumn)

not worked @supermanPunch , its deleted whole data

input:

Output:

I have to remove above balnk rows and have to remove entire column if balnk header or entire column balnk then have to remove entire column without knowing the index
Note: above blank rows also without knowing index

For empty rows You can use
DataTableName.Rows.Cast(Of DataRow)().Where(Function(row) row.ItemArray.All(Function(a) Not a.Equals(“”))).CopyToDataTable()

Hope this helps