In an excel if a cell contains data empty, how to delete entire row. Can anyone help me with this please

In my excel data contains empty cells, then i want remove entire row. Can anyone help me with this.
please find below screenshot for reference.

@PriyaReddy

Use for each row in excel and check if it is empty using if condition

And then use delete rows activity

Or reqd the data into datatable and then filter with empty rows and then write the data back

Cheers

@PriyaReddy

dt1.AsEnumerable.Where(Function(a) not a.ItemArray.any(Function(b) b.ToString="")).CopyToDataTable

This expression removes all the rows which are having empty cell values

Hi @PriyaReddy

First you get the datatable by reading the excel. Afterwards, you can delete the empty lines with the filter activity and later write the datatable to excel.

Hope this helps :slight_smile:

No, It’s not working

I tried It’s not working

Can you share screenshot of it. You need to mention the column index right in the column field.

@PriyaReddy

please tell what is tried and what is not working…else we wont be able to help without details

cheers

Here, i want to read particular column for eg. “H”. If in H column cell had data as empty then i should remove entire row.

I have tried read a Particular column and taken one for each activity and if condition inside that. Has applied a condition if that column name contains " ", then added delete row activity. and after that writing data.

@PriyaReddy

try this

cheers


Please find my code for reference.

Put column no right it starts from 0, if it is H it will be 7 in column section. Also in read range keep range as blank so that it will take the whole sheet as datatable.

@PriyaReddy

Try this way by using Equals

Can you tell me what mistake i have given here, Trainee TR01 should be deleted in H column but its not doing.

Can you share your Excel file & what you want to do

I was not able to send file coz, i was new user. This is data in my excel.here, i want to remove empty cell and Trainee TR01 to Trainee TR20.

@PriyaReddy

did you try the above filter and delete rows directly on excel

cheers

Yes, Empty cell is removing but no sure why it’s not deleting Trainee data.

Actually, i have implemented other logic but i have more than 2000 rows due to that it’s taking too long to complete process. That’s the reason i want to change my logic to increase accuracy.