How to put headers only once in a csv file

Hello,

I would like to know if it's possible to add juste one time the row of headers in a csv file with the csv node beaucause I don't find how to do it without programming a function ... is there another way ?

Here is my subflow :

And here is my payload and the output of my csv node :
image

So I would like to have only one time the description of my values and not at each shipment of my sensor.

Thanks

There is an option in the csv node to send headers once or not send headers.

Yes you can send it or not but when you choose to send it, for each payload you have the headers back.

if you pick option to send once, it will only add header the first time it runs.

or

don't send header and add the header to the csv file to start with.

I have just these options for my csv node :

And when you say to add header to teh csv file to start with how you know when it start ?

Before I used an exec node to write in the csv file and I used some flag to know if it's the beggining of my file or not.

You are probably running on an old version, if you want the settings I suggest you update node-red.

when i say add header to csv at start, I mean create the csv file and add the header manually, or use the file nodes to check for file, if it does not exist create it with header on first line.

Ok thanks for your help, I'm going to look for solutions with your response.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.