SOLVED: CSV Nodes Creates Triple Quotations

I need to store a value into CSV as “Value”, but when I add delimited quotations in a function node value, send through the csv node and store into a file, if I open the resulting file in Notepad I get “”“Value”"" but if I open in Excel it shows as “Value”.

I have tried a wide variety of ways, but with no success. I either get NO Quotations, or Triple Quotations. Single Quotations work, but are not suitable for this application (not my choice).

I have even tried:
var quotes = String.fromCharCode(34);
formattedTime = quotes + formattedTime + quotes;

Way to recreate:
From a function node
var formattedTime = "12-10-14 12:30:00";
formattedTime = "\"" + formattedTime + "\"";

Store the value in an array, send msg.payload through csv node and save to a file.

  • [ ] Node-RED version: 0.18.7
  • [ ] node.js version: 8.11.2
  • [ ] npm version: 5.6.0
  • [ ] Platform/OS: Ubuntu 18.04 LTS

Why do you need quotes ? CSV files are fine without them. You only need them if the value contains a comma, and the time string you have shown doesn’t…

Yes, I agree. This isn’t a requirement I have control over.
The main reason is the way the data is pushed into a database by another host. Which I have no control over.

If its a simple CSV then maybe use a template node to create the lines instead of CSV node ? Eg
Etc and then to a file node

Potentially I might have too. I have already started working on a function to do so.

The CSV is generated from a nested array of varying length, so it was convenient to have it build via the node.
Hence the hope to continue using it.

So I ditched the CSV node and used what I found here : Converts a 2D array into a CSV file · GitHub

For anyone else who needs to solve this problem in Node-Red:

function arrayToCSV (twoDiArray) {
var csvRows = ;
for (var i = 0; i < twoDiArray.length; ++i) {
for (var j = 0; j < twoDiArray[i].length; ++j) {
twoDiArray[i][j] = twoDiArray[i][j]; // Handle elements that contain commas

var csvString = csvRows.join('\r\n');
return csvString;


Also, this is only necessary if your target application doesn't support the CSV standard.