Loop does not execute next lines of CSV

Hello my friends!

I have a difficulty.
I need to execute tasks in a Loop with different information. I created a code, but I don’t want to determine the number of repetitions, I want it to run from the first to the last line of whatever is inside the CSV.
I managed to do this, but the Loop always repeats the first line.
In this example, the CSV has 4 lines, it repeats the first line 4 times.
What could be wrong and how can I make it execute all the lines?

{
  "Name": "DISTRIBUIÇÃO DE VAGA - POLO - V 1.0",
  "CreationDate": "2024-8-8",
  "Commands": [
    {
      "Command": "csvRead",
      "Target": "base - vinculação de polo.csv",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return 1",
      "Value": "currentRow",
      "Description": ""
    },
    {
      "Command": "while_v2",
      "Target": "${currentRow} <= ${!csvReadMaxRow}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "${currentRow}",
      "Value": "!csvReadLineNumber",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "xpath=//input[@name='curso[${!COL1}][polos][${!COL3}][nu_vagas]']",
      "Value": "${!COL4}",
      "Targets": [
        "xpath=//input[@name='curso[${!COL1}][polos][${!COL3}][nu_vagas]']"
      ],
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return ${currentRow}+1;",
      "Value": "currentRow",
      "Description": ""
    },
    {
      "Command": "endWhile",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}

Can anyone help me with this problem?

Based on the commands in your code e. g. “endWhile” instead of just “end”, this looks like this is some older code. Where did you find it?

Anyway, have you seen the DemoCsvReadWithWhile macro that gets installed with the extension? I think it does exactly what you need to do, or? I would use that as starting point.

Hello my friend, your answer helped me. I managed to solve my problem!
Thanks!