Get first cell of a Datatable with headers

Hi does anyone know how to get the first cell of a datatable? I’m looking for the cell A1 (which is a column name in this case because I have headers) not the first item of the datatable.

@inyourgravity, Assign activity

String strFirstColName = (From col in dt.Columns.CastOf(System.Data.DataColumns)
Select Cstr(col.columnName)).Tolist()(0)

Regards,
Dom :slight_smile:

HI @inyourgravity,
use the below code to get first column name from the data table.
Datatable.Columns(0).ColumnName.ToString()

Regards,
Arivu

1 Like

If you read it from an excel file you can just use ReadCell activity indicating cell A1 or if you already have the DataTable, the easiest way is:
yourDataTable.Columns(0).ColumnName