Create header row in csv with csvSaveArray

I am trying to create a row of headers (header 1, header 2, header 3, etc) in a csv with the csvSaveArray command. I am currently achieving this with the store and csvSave commands. The reason I am trying to switch this process to a csvSaveArray approach is that it would overwrite the existing content of the csv.

I have looked at the DemoCsvReadArray macro. Unfortunately, my knowledge of javascript is rudimentary and I could therefore not figure out how to do a two-dimensional array to create such a header row.

Any help or hint in the right direction would be much appreciated.

Cheers

1 Like

Nevermind. I have figured it out.

{
      "Command": "executeScript_Sandbox",
      "Target": "var arr= [[\"Header 1\",\"Header 2\",\"Header 3\",\"Header 4\"]];return arr",
      "Value": "header_row"
    },
    {
      "Command": "csvSaveArray",
      "Target": "header_row",
      "Value": "output.csv"
    },