Read Range activity: How to select specific columns only?

I have an Excel sheet, and it has many columns (say column A through column Z).
We know the name of the columns, or the name of the last column. However, we don’t know how many rows there are in this table, as it varies each time.

Now I want to read the datatable from this table, but I want to remove any columns after column S, and it should not be included in the datatable.
How could do I achieve this in Read Range Activity?

1 Like

Hi @tomato25
You should be able to achieve this through the data table filter wizard where you can be specific about which columns are required. You will have the same option for rows also. As for knowing how many rows of data you can capture this in a variable using the following datatablename.Rows.COUNT
Good luck
Paul

1 Like

@tomato25

  1. use Read Range Activity to read data and will give you output as dataTable and named it as DT1. (Specify range as " ")

  2. Int32 rowCount = DT1.rows.count

  3. use Read Range Activity to read data from column A to Column S. And specify range like this:
    "A1:S"+rowCount.Tostring

5 Likes

Hi buddy @tomato25

Hope you have a datatable Variable named outdt
–while before trying to use that variable any where which has all the columns…we need to get only the columns until column-S, like this
O
Finaldt = outdt.DefaultView.ToTable(False, “column-A”,“column-B”,“column-C”,…“Column-S”)

This will give only the datatable with columns till column-S, where the Finaldt is a variable of type datatable

Hole this would help you buddy
Cheers @tomato25

2 Likes

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