Read selective column range


Imagine there is data from A to H column
however, in column A and G and H data is always fully written
but from column B to F, it is not decided how many rows will be written in the data

so i would like to know how many rows data is written in the file by using dt.rows.count

but in order to do this i have to read range, but then i get all the data from Column A to H.
How can i only read from column B to F ? only problem is that number of rows of data is not decided
so i cannot use sth like read range form B1:F1

quick response will be very much appreciated


Hi @Seonyong ,

  1. Use read range to read the data from Excel to datatable
  2. Apply select query to read only those rows that contain data either in one of B to F columns.
  3. Select query will give you a result of array of data rows. You can check array[Datarows].Length
    Convert array(datarows) to datatable and then check row count -> array(datarows).CopyToDataTable().Rows.Count