Excel skip row

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.

How can this be performed. thanks in advance

@langsem

  1. Read entire excel using Read Range
  2. Loop through the datatable using For Each row in datatable
  3. 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
1 Like

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

what u mean something else ?

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

1 Like

Mark it as Solution if I have solved your query.

Cheers

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)

2 Likes

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

1 Like

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

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