Saving CSV Data

Hey,

I think I only have a small problem. Nevertheless, I do not know what to do. I have made a flow wich create files to an ftp File and name them by some parts of the payload. The saving process works, but i can not open the csv data. The error text says that the path isnt there.
Then i tryed to save the data on a local hard drive. But also an Error: Fehler beim Schreiben in Datei: Error: ENOENT: no such file or directory, open 'F:\HomeeVerlaufsdaten\all
[{_id__1.csv' .
The function to create the file name is: msg.filename ="F:/HomeeVerlaufsdaten/" + msg.PayloadString + ".csv"; (msg.payloadString is the variable name based on the payload and it still works for ftp)
When im try to save the file by an not variable name, for example: "F:/HomeeVerlaufsdaten/test.csv", it still works and ich can alos open it in exel.

PS: FTP is just a stopgap, I actually need the data on a local hard drive. But it would also be good if I have the data on an FTP and can work with it

Welcome to the forum.

Add a debug node showing what is going to the file node, and set it to output Full Message and check whether the content is correct. If it looks ok then show us what you see there and also show us how the file node is configured.

I posted (and resolved) a question a while back about filepaths for saving a csv that was created & named using Node-RED. Maybe it will help.

not really, but thanks

Have you done what I suggested with a debug node?

The Path for the local hard drive is : F:/HomeeVerlaufsdaten/attribute
___id__135.csv ( "F:/HomeeVerlaufsdaten/" and ".csv" are given in the funktion and only the attribute is based on the payload

for ftp it is: //fritz.box/FRITZ.NAS/HomeeVerlaufdaten/attribute
___id__103.csv and it works.

is it possible that the problem is the little arrow behind attribute

That screenshot is unfortunately illegible on my system. Please show just one output from the debug node and make sure you expand it fully so it is all visible. In fact better to hover over the top of the debug and click the Copy Value button that will appear and paste that here. For the function, if you want to post it then please paste the text using the </> button when pasting it in.

Edit: Also you have not shown how the file node is configured

Yes, seems you have a carriage return in your filepath, in your list of replaces try adding this:

PayloadString3 = PayloadString3.replace(/\r?\n/,"");

Thank you very much. That was actually the problem and you solved it. But first you have to come to the conclusion that in this case it is because of it and that you have to solve it that way. I would never have thought of it in my life. Thank you, thank you, thank you :slight_smile:

1 Like

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