How to remove a row from a Excel Data Table?

Qualcuno mi saprebbe aiutare? vorrei rimuovere una riga vuota da una colonna… ma non so come fare

vi sarei molto grato se mi deste una mano.

1 Like

Hi @momi_fede,

Pode usar esta query que remoer o row tem empty.

dtExcel.Rows.Cast(Of DataRow)().Where(Function(row) Not row.ItemArray.All(Function(field) field Is DBNull.Value Or field.Equals(“”))).CopyToDataTable()

Regards
Balamurugan.S

Refer this @momi_fede

Thank you for replying but I do not know how to use this code

1 Like

Hi @momi_fede,

Eu anexei o fila por testar que tem o codice.

My Portuguese is not good. You can able to understand by this example clearly.

Fila : RemoveEmptyRows.xaml (9.3 KB)

Regards
Balamurugan.S

1 Like



I want to check if the “Status” column has empty values … if I want to delete the whole row… can you halp me… I’m very desperate :sweat_smile:

1 Like

Hi @momi_fede,

keep the condition like this

String.IsNullOrEmpty(row(“Status”).ToString())

or

row(“Status”).ToString() =“”

Regards
Balamurugan

1 Like

This error generates me … how can I solve it?

Hi @momi_fede,

can you share the source ?

Regards
Balamurugan

RemoveEmptyRows (1).xaml (11.4 KB)
SAMPLE1.xlsx (8.1 KB)

I tried with this method … it eliminates the empty lines but I add one … you could look at it kindly

Check the source .

File : RemoveEmptyRows (1).zip (2.3 KB)

Regards
Balamruugan

Hi @momi_fede,

I have suggest to delete the rows base on the condition that can use the below activity without having more code. A single activity will do all the things. It has the sample also… you can try it.

Regards
Balamurugan

Hi @momi_fede

Here I have attached the sample

BalaReva.DataTable.Activities
Remove Data Row Select

You have to install the package

Here is the activity.

Source : DeleteRowSelect.zip (8.0 KB)

Regards
Balamurugan

if instead I wanted to delete the lines from a table, how would your advice be to do this?

in any case I thank you for the great help given to me, I am grateful

Yes. you can able to remove the line form table based on the condition.

Regards
Balamurugan

using “RemoveDataRow” Activity?

but this activity has been added recently, right?

No @momi_fede. I am telling about the “Remove Data Row Select” activity. Already I have attached sample for you.

Regards
Balamurugan

I got it!! I thank you again for the help!!

welcome @momi_fede

I have uploaded 2 pacakages in the gallery.uipath.com. if you want , you can use these…

Regards
Balamurugan

1 Like