Not Able to Save Date In CSV File

I designed a macro that should first pick artist name from a CSV file search it and then scrap and paste a date into same CSV file.
The first step picking artist’s name is working well, but UI VIsion is unable to save date into CSV file.
Actually, it saves and when it saves new data for another artist it erase first written date.
is there any stable way so that I can save data into a CSV file.

{
  "Name": "spotify",
  "CreationDate": "2023-6-26",
  "Commands": [
    {
      "Command": "csvReadArray",
      "Target": "Artist Release Radar Alerts.csv",
      "Value": "csv",
      "Description": ""
    },
    {
      "Command": "times",
      "Target": "${!CsvReadMaxRow}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return ${!times};",
      "Value": "i",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://open.spotify.com/search",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "xpath=//*[@data-testid=\"search-input\"]",
      "Value": "",
      "Targets": [
        "xpath=//*[@id=\"main\"]/div/div[2]/div/header/div[3]/div/div/form/input",
        "xpath=//input[@value='']",
        "xpath=//input",
        "css=#main > div > div.ZQftYELq0aOsg6tPbVbV > div.PHgyArRLVFknlaOm31ID > header > div.rovbQsmAS_mwvpKHaVhQ > div > div > form > input"
      ],
      "Description": ""
    },
    {
      "Command": "sendKeys",
      "Target": "xpath=//*[@data-testid=\"search-input\"]",
      "Value": "${csv[${i}][0]}",
      "Targets": [
        "xpath=//*[@id=\"main\"]/div/div[2]/div/header/div[3]/div/div/form/input",
        "xpath=//input[@value='']",
        "xpath=//input",
        "css=#main > div > div.ZQftYELq0aOsg6tPbVbV > div.PHgyArRLVFknlaOm31ID > header > div.rovbQsmAS_mwvpKHaVhQ > div > div > form > input"
      ],
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=//*[@data-testid=\"herocard-click-handler\"]",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=(//*[@data-testid=\"card-click-handler\"])[1]",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "pause",
      "Target": "1000",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=(//*[@class=\"contentSpacing\"]//p[@data-encore-id=\"type\"])[1]",
      "Value": "a",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "var str = ${a};\nvar str = str.replace(\",\", \"-\");\nvar str = str.replace(\",\", \"-\");\nreturn str;",
      "Value": "a",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "var g=${csv};\ng[${i}][1]=${a};\nreturn g;",
      "Value": "csv1",
      "Description": ""
    },
    {
      "Command": "csvSaveArray",
      "Target": "csv1",
      "Value": "Artist Release Radar Alerts.csv",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}

I use ui vision and saving data in the csv works perfectly, I don’t notice any kind of problem, check your macro maybe there are errors.
I don’t use the csvReadArray command for the reason that the numbering of rows and columns starts from 0 and it confuses me but with the standard ui vision commands everything works perfectly

…paste a date into same CSV file.

Update your csvSaveArray from csv1 → csv.

The loop reads the array, modifies row ${i} then saves the entire array as a csv. By saving to csv1, you are essentially overwriting all the previous row saves for the latest row. Hence, only the latest row contains a value in column [1]

First I tried “CSV” variable instead of “CSV1” but it does not work

This will fix it:

    {
      "Command": "executeScript_Sandbox",
      "Target": "return ${!times} - 1;",
      "Value": "i",
      "Description": ""
    },

The “- 1” was missing so you were writing the first row over and over.

I make ui vision to always read CSV file in a loop and now it is working fine.