Why 'store... !csvLine' inserts double quotes no matter what?

When I try to store my string in always inserts double quotes (").

store | \n | var

var = “\n”

Even if I put single quotes or even double quotes it does it anyways.

store | ‘\n’ | var

var = “’\n’”

store | “\n” | var

var = “”\n""

But storeText has no such problem. It stores the exact piece from the DOM.

storeEval might give me the result i need, BUT if there is a slash" or " in the line its done… more " on both sides of the full line.

Please help.

1 Like

I don’t see or understand this problem yet, where is the additional “”? Here is my test:

{
  "CreationDate": "2018-9-17",
  "Commands": [
    {
      "Command": "store",
      "Target": "abc 123",
      "Value": "aaa"
    },
    {
      "Command": "echo",
      "Target": "aaa = ${aaa}",
      "Value": "blue"
    },
    {
      "Command": "store",
      "Target": "\\n",
      "Value": "aaa"
    },
    {
      "Command": "echo",
      "Target": "aaa = xxx${aaa}yyy",
      "Value": "green"
    }
  ]
}

aaa

Ok. Try this:

{

“CreationDate”: “2018-9-18”,
“Commands”: [
{
“Command”: “store”,
“Target”: "\n, , , ",
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “test”,
“Value”: “”
}
]
}

Now see the result in csv:

1 Like

Ok, now I understand. It seems the !csvLine documentation was not very clear about this.

When pushing data into !csvLine, you need to store every value separately. Because once csvSave is called, every value that is stored in the !csvLine internal array will get wrapped with “…” automatically (if needed) before saving.

Example:

csvline

{
  "CreationDate": "2018-9-18",
  "Commands": [
    {
      "Command": "store",
      "Target": "first column text here",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "/n",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "\"great\" she said",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "5th column",
      "Value": "!csvLine"
    },
    {
      "Command": "csvSave",
      "Target": "testcsv",
      "Value": ""
    }
  ]
}

This does not make any more sense to it.
Who defines the “need” for that?
Even if you try so save empty line with “” it will double wrap it again “”""".
Is there a need? I doubt that.
And THE most important thing:
Try saving next line (\n). In your example /n is not next line.
This wraps it up in “” which is a total disaster.
And if there is a need for that it is completely messed up my friend.
You cannot start a next line without double quotes.
This puts HUGE restrictions on working with csv file.

If this cannot be fixed how do I store data to file directly without middle array that messes up the output?

It works fine with\n as well. It gets sourrend by “” as per the CSV file format definition. I guess I do not understand your goal correctly: Do you actually want to save a CSV file, or do you want to create some other file format?

cnn

The goal is to use special characters.
\n
\"
etc…

Here is the case for you:

I collect data which I analyze later in calc (LibreOffice Excell substitute)

I need to break the line which I do by saving file every-time I need to, but this is a workaround. I should have just use \n.

Next I need to insert a link and if just put href it is not clickable. So I need to insert =HYPERTEXT(“link”,“click”)
But I cannot store \" it does wrap whole line with doublequotes which makes everything useless.

Definitely there should not be mandatory doublequotes wrap. If everything is messed up because of my mistake not putting quotes this is one thing. But if I cannot do certain things because somebody decided to help and wrap a text for me with quotes this is another.

I’m not sure if I explain correctly. Sorry about that.
Can you see why double quotes are a problem?

Is there any workaround to save multiline csv file without additional quotes?

Suppose I’m getting a big piece of html page through regex in sourceExtract. Then I’d like to save exactly what I see on the html source page in csv. Is it possible?

Or suppose I have a variable like:

some text
some text
some text

When I save it to csv I’m getting:

"some text
some text
some text"

How can I avoid adding these quotes and get the csv without them?

Question: Do you actually want to create a CSV file - or do you prefer to simply save the info to a normal text file?

I want to save info to any text file: csv, txt… The goal is to get exactly the same text in the file as it was in Kantu plugin. If I save a variable like this:

some text
some text
some text

I’d like to see in saved file:

some text
some text
some text

This is not good because csv require quotes.

You can run a batch file to remove quotes from your csv, and you can run a batch file with kantu.

This is good when you save what you see, not what Kantu thinks of it. I didn’t know that it is impossible for Kantu. Again, I’ve never had a problem to save in the csv exactly what I see in program.

Quotes in csv are necessary to be able to save any characters, it makes no sense to save a csv without quotation marks, if you need to get it with a software via conversion or batch file but in csv it is basic to use the quotes that allow you to save so also commas, semicolon without damaging the structure of the csv.

Quotes are not necessary. Look at this file. Is it csv? - Yes, multiline csv. Do you see quotes? - No.

Any further improvements to this discussion pls?

@senod

In your case you have a file with only one column.

=> What you actually need is the ability to simply save text to a file, right? Something like a textSave command in addition to our csvSave?

csv1

A post was split to a new topic: Add blank line to CSV

I’m with same problem. I have a backend API on my Online App, that’s result a csv file format ready to save, and Kantu add quotes automatic, causing problem. I explain why:

My CSV had a big size, if I returned an array and to save it’s necessary to do a forEach (more than 1000 lines), it’s very slow!!

Wht do you use a csv with 1000 lines what is the sense of this action ? Use a small csv.

Quotes need to avoid error in csv, in csv to add comma you need to have quotes

“my home, my pet”

If ui vision do not add quotes “” csv will be corrupted and do not work.