Saving CSV data like original dataset prior to ftp

Would anyone have a tip for how to make my CSV data look like the data that was sent via FTP to a node red FTP server instance?

This is my flow, note the curly braces in debug window that how my Excel spreadsheet looks too.

This is what the data looks like before being FTP'd up the node red FTP server:
image

And when I retrieve the data from node red ftp server it looks like this all garbled. It seems like somewhere two sets of time stamps and electric meter readings are getting combined in an unwanted fashion.

Function block in my flow that Steve helped me with previously:

msg.payload = msg.payload.toString();
return msg;

My CSV node in the flow:

The data is sent from a Windows machine for what its worth and Node Red is running on Ubuntu 20.04.

This is the file node:

Any tips greatly appreciated I assume I need to add in a function block somewhere with some JavaScript code. Any JavaScript tips greatly appreciated not a lot of Wisdom there yet.

Hi

You receive the file as binary data. In the function you convert it to a string, so now you have the csv text string.
You then run it through a cvs node, you tell it to ignore the 1st row(which is the colums). Then you say use the first row as column names. So now the second row is used for column names. That's your first error.
Your cvs nodes outputs a msg for each row so you get an object with name of property from second row (as stated above). Then each msg is sent to file node, which converts it to a string and appends it to the end of the file.

I think you just want to send the msg from the function straight to the file node, you do not need the cvs node.

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