How to test all data from excel in one input field

Hello users,
Please Im struggling to find a solution to one problem. I have one input field/box and Im loading into it data from excel file. After its done there is a click function and after the click again Im loading data again into the same input field from the same excel file. And this goes one 40 times. In the excel I have one column and 8 rows. What I need is to load firstly the data from 1st row, 2nd time from the 2nd row, this goes on…8th time from the 8th row, BUT 9th time again from the 1st row!!{as I have only 8 rows in the excel file}. And this would go until I reach 40 repetitions.

If this is no go, then I would be also ok with 8th repetitions but every time the data would be loaded from next row as first time from the excel file.

Thank you for any ideas.

This would probably work fine:

import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

TestData data = findTestData('path/to/test/data');
for(int i = 0; i < 40; i++) {
	for(int j = 1; j <= data.getRowNumbers(); j++) {
		String value = data.getValue(1, j);
		WebUI.sendKeys(findTestObject('path/to/field/object'), value);
	}
	WebUI.click(findTestObject('path/to/button/object'));
}
2 Likes

Thank you for your solution, I will test it!