I want to loop through the columns D to n number of columns. And the data will present only 4 columns of each excel. I want to check which column is having the data and fetch that data along with the header. I want to loop through each row as well. How can I do this? Can anyone help me on this please? I will attach the column format.
You can read the third cell or fourth of each column using a for each loop till the number of columns on excel. (You will get number of columns reading the excel using read range and the column count as datatable.columns.count), then you can find which column has values and store those four column numbers in an array.
Then you can loop through the data table using that particular column numbers as row(column number).ToString
To skip it till the forth item, you need to use the index (output of for each activity) like, if the index is greater than 3, then flow to THEN condition
I tried the way you suggested. Could you please suggest me how can I read each cell values. I know we can use String.IsNullOrEmpty to check the cell is having value or not. But I don’t know how to read each cell value. Normally we use rows.Item(0).ToString. I tried to change the parameter rows.Item(index_variable).ToString with index variable. But I’m getting error. How can I read values in each cell column by column for each row?
Use for each row and increment the values in the row(0).tostring that will read the column value of that row based the index. Try this way and let me know if that helps