How to extract the last row value from the datatable from single column with no headers

I am having an excel file with single column data with no header and I need to extract the last value from the excel file.

Any suggestions would be helpful.

Thanks.
Nawaz.

use read range activity without headers

dt.rows(dt.rows.count-1).item(0) this will give you the last value

Hi @Mohammed_Nawazuddin

Please use an assign activity:
leftside: LastRow (DataType is DataRow)
right side:

YourDatatableVar.AsEnumeration.Last()

or

YourDatatableVar.Rows(YourDatatableVar.Rows.Count-1)

Thanks.

Hi,

I have tried the same but its giving the below error.

Thanks,
Nawaz.

And I am passing datarow as string I need a sing value

It should be
st.rows(st.rows.count-1).item(0)

i think you missed .rows

YourDataTable.AsEnumerable.Last()(0).toString

Hi @Mohammed_Nawazuddin did it work?

Hi,

It didnt work .

Thanks,
Nawaz.

datarow variable should be string type and in value also convert to string

dt.rows(dt.rows.count-1).item(0).ToString

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.