How to read all rows except the last row in excel

I do not know how many cells will have text so I don’t know where to tell it to stop.

Hi @brettthompson
I think u can try this alternate way

  1. Read the excel and store in dt1

  2. Now use remove row with following paramter

DataTable: dt1

Rowindex: dt1.Rows.Count-1

Then the output will contain only the datatable without the last row data


Nived N

Happy Automation

I wasn’t clear. I need it to read all data except the last row not count how many rows contain data

I have this row.item(“0”).ToString to write all of the data

Hi @brettthompson
Check this workflow

You will get the idea
Main.xaml (6.4 KB)


Nived N

Happy Automation

from the title of your post we could interpretate:

  • get all rows except the last row

we can do:
Assign Activity:
leftside: dtReduced (Datatype: Datatable)
rigth side: YourDataTableVar.AsEnumerable.Take(YourDataTableVar.Rows.Count - 1).CopyToDataTable