Read column from excel then add to an array

Hi, i’ve a simple flowchart that open a dialog to select an excel file, read the B column from 2 to last row, add item readed into an array.

How i can do this?

The select file and read cell it’s done. But how i can read from specific cell (B2) to the last cell of B column?

And how i can store the readed values from excel to an array?

Sorry for my noobism and thank you for your help

@Danny_Gi
Welcome to the forum

give a try on following part flow, we assume a string array will work (0therwise we adopt)

  • read range - read the excel (all rows) to a datable - YourDataTableVar
  • assign activty
    left side: arrColVals - datatype: String() - String array
    right side:
    YourDataTableVar.AsEnumerable.Skip(1).Select(Function ( r ) r(1).toString).toArray

Assumptions:
first row in Excel represents the column name
r(1) - Column B is to extract

1 Like

Check this one!
Excel.zip (44.8 KB)

1 Like

image

I’ve assign a variable to selected file function called “SelectedExc” and put to read Range function the variable (because the excel file name isn’t always the same). But there is an error. See the attached screenshot.

Thank you! Whatching this

it works ! are you sure the file exists in the location? check the value of the Variable SelectedEXC

the used sheetname setting is the variable SelectedExc but looks like it is having no value.
Here we do also see a relation to the message “sheets does not exists”

Just ensure that a valid sheetname is used.

As the ranged is limited to B2:B… maybe the statement needs to be adopted from r(1) to r(0) just give a try

Yes the file exist, the error IS the Sheet name i think
How i can open and read the file without know the sheet name? E cause the Excel file are generated from different pc in the net and i dont know the sheet names

Time to come back in Office and try. Thank you

Exactly, I thik the sheet Name is the main problem here!

Ok, not it seem to be work.
But the value from array not showing correctly. Why?

In your For each block you should put the value of " Item" in your message box and not “arrColVals”

Sorry but i don’t understand…i should put the value? I need to read the value from array as a text like it is write in excel.

If in excel in example the B3 i’ve: Matthew
i want to read for each cell put in array the value. In this case message box “Matthew”.

image

@Danny_Gi - Please check this post…

I guess, this is what you are looking for…In this post, I have first converted the datatable (one column) into an array later used that array in the input dialog acitivity(which you can ignore)

omg you’re right! Thank you!
How i can do this to all values in column B without empty cell?

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