Read variable number of columns in Excel Sheet and save in a variable


Hi.
I’m trying to read an Excel file which has not a fixed number of columns but a variable number of columns.
I saved the number of total columns in an integer variable, which varies according to the used Datatable.
I would like to know:

  1. how I can extract the current number of column in the While Activity;
  2. how can I can READ only the column with the current column number;

I would like to use READ RANGE Activity to read the column variable because I need a DataTable variable to perform successive tasks.
Thank you in advance,
Camilla.

By Column Index colNo= TargheData.Columns.IndexOf(col)

1 Like

Thank you @vvaidya :grinning:
Is there a possibility to save only the COLUMN with the colNo index in a DataTable variable?
Thank you.
Camilla

something like this? 1 is arbitrary column number

dtTemp=TargheData.DefaultView.ToTable("",false,{TargheData.Columns(1).ColumnName})

1 Like

Thanks so much @vvaidya.
It worked correctly.
Here I attach the screenshots.

!

Thank you so much.

1 Like