How to Get sequential Values form Excel Sheet

How to Get sequential Values form Excel Sheet

As currently i’m using code to get random values
But i need to get Sequential values

@sara.alyahya After you read in the first value from Excel sheet, start a for loop that gives you the next set of sequential values. Or just keep adding one more to your Excel value. Or enter two values in sequential order in Excel, then highlight the two values and drag the mouse down (or across) until you have the number you want (or you can select Fill from the Home > Editing section, then Series and finish how you want) and continue to read the values from Excel; again just add one to the starting value.

example of for loop:
for (int icnt = XCelValue; icnt < XCelValue + 22; icnt++) {…

example of value increment (can be within for loop or a sequential added value):
…getValue(irow, icnt)

my current script get random values
how can i edit it to get sequential values
def fillTellerName(){
ExcelData sheet1 = findTestData(‘Demo’)
Random rand = new Random()
int rowCount = sheet1 .getRowNumbers()

	int rowLV = (rand.nextInt(rowCount - 1) + 1);
	
	String Teller = sheet1 .getValue(1, rowLV)
	
	WebUI.setText(findTestObject('Page_Excluded Tellers - goAML/input_Teller Name_TELLER_NAME'), Teller)

Hi @sara.alyahya

for(int count = 0; count < 10; i ++) {
  	int rowLV = 0;
	String Teller = sheet1 .getValue(1, rowLV)	
	WebUI.setText(findTestObject('Page_Excluded Tellers - goAML/input_Teller Name_TELLER_NAME'), Teller)
}

The above piece of code will eventually set to the input values from 0 to 9. Is this what you’re looking for ?

@sara.alyahya Combing your code with the earlier one

ExcelData sheet1 = findTestData(‘Demo’)
Random rand = new Random()
int rowCount = sheet1 .getRowNumbers()

	int rowLV = (rand.nextInt(rowCount - 1) + 1);
	
      for (int icnt = rowLV; icnt < rowCount; icnt++) {

	String Teller = sheet1 .getValue(1, rowLV)

	WebUI.setText(findTestObject('Page_Excluded Tellers - goAML/input_Teller Name_TELLER_NAME'), Teller)

No dear …
it not working in my case

I need to get sequential values from excel sheet , in each time i running the test case , to bring a new values

for example i have a column called teller name and it have different name
1- sara
2- jad
3- john
.
.
.
.

and in every time i run the case i want a new value sequentially

Looks like I had an error in the getValue line. It should be the loop counter, not the random number.
ExcelData sheet1 = findTestData(‘Demo’)
Random rand = new Random()
int rowCount = sheet1 .getRowNumbers()

int rowLV = (rand.nextInt(rowCount - 1) + 1);

for (int icnt = rowLV; icnt < rowCount; icnt++) {

String Teller = sheet1 .getValue(1, icnt)     //oops, my bad

WebUI.setText(findTestObject('Page_Excluded Tellers - goAML/input_Teller Name_TELLER_NAME'), Teller)

Thanks for trying to Help

But still not working with me

could you please write down loop for my case

In the first cell of the range that you want to number, type =ROW(A1).

The ROW function returns the number of the row that you reference. For example, =ROW(A1) returns the number 1.

Drag the fill handle Fill handle across the range that you want to fill.

@sara.alyahya You may have to give more information than it is not working to assist us in helping, but I thought your code did most of what you wanted. I just added the loop counter to it. At the end of the for loop line there is a curly bracket and after the very end of the delay that I added (so you can see the text added) is an ending curly bracket–the code enclosed by the curly brackets is what will be repeated within the loop.

ExcelData sheet1 = findTestData(‘Demo’)
Random rand = new Random()
int rowCount = sheet1 .getRowNumbers()

int rowLV = (rand.nextInt(rowCount - 1) + 1);

for (int icnt = rowLV; icnt < rowCount; icnt++) {

String Teller = sheet1 .getValue(1, icnt) 

WebUI.setText(findTestObject('Page_Excluded Tellers - goAML/input_Teller Name_TELLER_NAME'), Teller)
WebUI.delay(2)

}