I have to carry out a process in which the input Excel is not by columns but by rows. I attach the example, how to save the value of age, title, surname and first name if the Excel structure is by rows?
prueba.xlsx (10.0 KB)
Assuming it will always be just two rows and columns per record…(I added a second item to make sure it works correctly)
Read into datatable without headers:
Build Data Data Table to store result:
Loop through rows, using an If to only process every other (even) row using the modulus operator, and Add Data Row to the resultDT. Remember that the rowIndex starts at 0, not 1, so the first row is even.
Make sure to create a variable for the row index. Put your cursor into the Index property, press CTRL+K and give it a name then press enter.
ArrayRow for Add Data Row activity: {sourceDT.Rows(rowIndex)(1),sourceDT.Rows(rowIndex)(3),sourceDT.Rows(rowIndex+1)(1),sourceDT.Rows(rowIndex+1)(3)}
That means take the 2nd (index 1) and 4th (index 3) columns for the current rowIndex, and the 2nd and 4th columns for the current rowIndex+1 (so the next row).
Result:
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.