Hello i have a excel sheet where i use for each row to loop through. I also have a column named “STATUS” where i insert a string after every process. I want to make a if function where it checks that column status first, if it contains something then it should move to next row.
Loop through the datatable using For Each row in datatable
Use IF condition to check if that column has something else continue to next record
row.Item(“STATUS”).ToString will fetch the you the value from Status column
hm, I am alrdy using a for each row on my datatable. I have assigned a variable to the for each row index so i can keep track of what row i am at. think i have a solution actually
Means use IF condition to check that your STATUS column has value or not. If has value move then continue to next record else process that record and update the Status column at the end of execution of that row
Was not sure of your solution, but I made it work. What i did was Used a excel app scope. then Read cell.
I then used the index var from each row into the range so make sure i check the correct cell. Then i used that output on if statement and set String.isNullorEmpty(output from the read cell)
This seems to be long procedure, you dont need to go and check Read Cell.
Just while looping in datatable, use
"row.Item(“STATUS”).ToString - this will fetch you the value of the current row of STATUS column, then use IF condition to check values and update accordingly
Yes know, only issue its that the STATUS column its a dynamic column, so it wont be updated in the datatable but in the excel sheet itself. So have to look upon the excel and not dt