Multiple values from CSV (More then 20+ people - possible number oscillation)

Hello everyone,
I’m new to this way of coding, so please help.
I apologize in advance if there is such a topic, but I did not find it.

This is a multiple entry of persons into the records system.
A CSV document can contain over 20 people with data (name, surname, e-mail … etc.).
My question: is there a way (Script) to “pass a CSV document” by taking some increment / loop that will mark any information, for example by typing code instead, (E0,2 = {myCSV [0] [1]}}) -> E**i**, **j** = {myCSV [i] [j]}) where i and j would increase by 1.

I wonder because the number of people can change over a few days / months / years, so there is the possibility of updating because the accounts expire every few months, so I just have to update the CSV document only.

In CSV:

    User1,John ,Smith,John.Smith@somecompany.com
    User2,Michael,Williams,Michael.Williams@somecompany.com

JSON:
> {

  "Name": "test",
  "CreationDate": "2020-10-9",
  "Commands": [
    {
      "Command": "open",
      "Target": "localhost",
      "Value": ""
    },
    {
      "Command": "csvReadArray",
      "Target": "test.csv",
      "Value": "myCSV"
    },
    {
      "Command": "echo",
      "Target": "E0,2=${myCSV[0][1]}",
      "Value": "firstname"
    },
    {
      "Command": "type",
      "Target": "id=firstName",
      "Value": "${myCSV[0][1]}"
    },
    {
      "Command": "echo",
      "Target": "E0,2=${myCSV[0][2]}",
      "Value": "lastName"
    },
    {
      "Command": "type",
      "Target": "id=lastName",
      "Value": "${myCSV[0][2]}"
    },
    {
      "Command": "echo",
      "Target": "E0,3=${myCSV[0][3]}",
      "Value": "email"
    },
    {
      "Command": "type",
      "Target": "id=email",
      "Value": "${myCSV[0][3]}"
    },
  ]
}

Thank you in advance for your reply.

What do you mean with this?

Do you mean that the the number of entries in the CSV file changes? That would be no problem. You can tell the RPA software to read “until the file end”.

And csvReadArray reads the complete CSV at once anyway. Then you can get the number of lines with the Javascript with yourArray.length => see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length

Thank you for your reply.

With that question, I thought: Is there a way the code can be reused regardless of the number of lines in a CSV document, I wouldn’t want to hardcode.

As in this case, the number of people with this information is variable. After completing the first entry and saving in the required variables, the entry needs to be repeated, but for the second person.

To loop I always use the While command
first you need to store your variables

Store | 0 | i
While_v2 | ${i} < ${nlines (?) } |
do stuff
executeScript_Sandbox | return Number(${i}) +1; | i
end | |
continue code

and you can acces the array like ${arr[${i}][0]} for example