How to clear the contents of a cell if it is blank(There may be some datas even if it is showing as blank)?

Currently i am using a macro to clear the contents of a cell in excel if it is blank.
But it is taking too much time.
Can anybody help me to solve this topic using invoke code.

C# or vb.net code to clear the contents of a cell if it is blank and no need to change other datas.

Regards

Sreejith S S

Hi @sreejith.ss ,

Could you maybe explain a bit more and show us a sample data for us to confirm what is to be done ? Also are you trying to clear the contents of a Single Cell ?

I am checking for a particular column if the column contains any blank values then need to clear the contents of a cell else nothing.

Regards

Sreejith S S

@sreejith.ss ,

Have you tried with the Write Cell Activity passing an Empty value ?
image

If you are already reading the data as a Datatable then we can check if any blank or Empty values exist using the below Expression :

DT.AsEnumerable.Any(Function(x)String.IsNullOrWhiteSpace(x("YourColumnName").ToString))

The above expression could be used in an If Activity and then use Write Cell Activity to write the Empty value to the specified cell.

Excel may have more than 50k rows.
So is it possible to have a c# or vb.net code to clear the contents of a cell.

Regards

Sreejith S S

@sreejith.ss ,

Have you tried with the approach mentioned above ?

We do not know the full implementation what you would need to do but do you think Reading the excel sheet is taking up time, if so, could you provide an approximate.

Also, in the suggestion provided above, we are assuming that you need to clear the contents of a Single Cell and not multiple cells.

Do provide us with more details on the implementation for us to be sure that you would indeed require an alternate approach than using the basic activities.

Hi, have you tried the method in this content?