Datatablename.select()

The link above teaches project organization and within it there is a concept of how to use select(), which can be found in more detail in the below link.

What I actually want to do is to find the first empty cell in an Excel sheet without using the method of getting all the data to a datatable and doing a loop. In the tutorial at the first line of this writing, the tutor used select(“status is not null”), which will be my ultimate goal to test for my goal.

But when I read data from a worksheet and use “select()” function, it returns an object which cannot be printed on the output panel. I tried to receive it with a variable of array[datarow] and print it but it does not work. I tried item(0) and item(0).tostring but none of them worked.

Do you have any idea of how to convert an object type derieved from the select() function into other types such as string or datarow?

Or if you have anything to say regarding this approach, it will be really appreciated, thank you!

Daniel

1 Like

The returned object may have multiple columns. Have you tried printing the value of a single column in your row? You’ll most likely need to do something like item(“ColumnName”).ToString.

I’ve noticed many people feel strongly against using for each loops for datatables returned from Excel files, but generally (unless you’re hitting hundreds of thousands of rows), the time it takes for this to execute is minimal and helps improve readability/maintainability of your code.

2 Likes