How to remove a row from a Excel Data Table?

datatable
excel
studio

#1

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.


#2

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


#3

Refer this @momi_fede


#4

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


#5

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


#6



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:


#7

Hi @momi_fede,

keep the condition like this

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

or

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

Regards
Balamurugan


#8

This error generates me … how can I solve it?


#9

Hi @momi_fede,

can you share the source ?

Regards
Balamurugan


#10

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


#11

Check the source .

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

Regards
Balamruugan


#12

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


#13

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


#14

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


#15

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

Regards
Balamurugan


#16

using “RemoveDataRow” Activity?

but this activity has been added recently, right?


#17

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

Regards
Balamurugan


#18

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


#19

welcome @momi_fede

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


Regards
Balamurugan