I have been trying to read this excel file and select certain rows/cells based on condition in column A. In this case, if the value in column A (Apple A) is Z67, get all the values in column C (Citrus) and write them into text file. So I should get CA, CB, CC, CD back.
At this point, I am just trying to get all the records that belongs to Z67. However, I get the error saying the object reference not set blahblah with the workflow that I have in the xaml.
Also, is there a way to select only column A and column C even before I start to create the dataTable? Using if else condition? I think it would be faster and more efficient because I don’t need all other information in that excel - only column A and column C.
Thank you so much for your rapid reply. The solution that you provided works well! And my next question is how to print all the result in one setting, i.e., [CA,CB,CC,CD] in a text file in separate lines.
Currently when I write text file, it only shows CD because it is overwriting the text file every time it goes through the for loop. I am thinking to assign a list string above the for loop, then add row into the list for each row. but how can I achieve this? Thanks!
p.s. I removed the forloop, and tried to use output datatable and show the result in the message box but all data are shown instead of just [CA,CB,CC,CD]…
And I tried to put invoke method inside the forloop to add on the empty list variable that I created, but I got "Ststem.Collections.Generic.List’1[System.String] as the result for my message box… Please see attachment