In a loop, the generated values are written to excel in turn

The same use case is run twice in a loop, and each time a value is generated. After running, the two values are written into the same excel in turn. The last two values I wrote before are the same, that is, they are overwritten by the second generated value. How can we make the values of the two loops output to excel?

hi ,I don’t understand what you said.

1 Like

Hi @rich.wan,

Please post your message in English.

The same use case is run twice in a loop, and each time a value is generated. After running, the two values are written into the same excel in turn. so,how i write the keyword?

there is page in documentation about writing to excel and it includes also keyword to do so, take a look at:


also try to look around, there is lot of reading regarding use of excel in official documentation and this forum too.

The last two values I wrote before are the same, that is, they are overwritten by the second generated value. How can we make the values of the two loops output to excel?

in line where you write value you put value of loop to row selector
something like:

sheet.getRow(loopVariableHere).createCell(1).setCellValue("Mahesh2");

Can you have complete code?I don’t understand what this is.‘loopVariableHere’

almost impossible task, since i don’t see your script, don’t know your application…

universal solution will be to have global variable that can be updated once TC was executed, and based on this value update row in excel loopVariableHere was ment as an substitution for whatever you have implemented.