Exporting array to a local file

#1

I am having extreme difficulty exporting information from Node-RED to a file on my local drive. To give some context, I am reading information from an external sensor into Node-RED, and I am trying to export that information to a CSV file on my local drive. When I used the Edit File Node, the information does not create/store in a file on my computer.

I have made a simplified version of my flow to test and see if I am capable of saving a simple file to my local drive. I mimicked the flow set up in this tutorial. As it turns out, I can't even save a file with this simple flow shown below:

Is there something wrong with my security settings? What can I do to fix this issue, because I need to store information onto a CSV file?

0 Likes

#2

All of the flow details are included on the tutorial link; however, I have provided further details below as well.

  1. The first function node should be generating an array of three simple words: car, bus, and train.

  2. The next function node should be saving the file into a CSV file on my local drive: C:\New folder\logs.csv

  3. The debug tab shows that the information is being generated properly because “car, bus, and train” is being displayed; however, when I navigate to my C drive, the file is not saved in the designated folder.

0 Likes

#3

so does the folder New Folder exist? Is there anything written in the Node-RED logs?

0 Likes

#4

Try setting the file path to:

C:/New folder/logs.csv

Or

C:\\New folder\\logs.csv
0 Likes

#5

Yes, I’ve created the file exactly where the file-path is specific.

If by “Node-RED logs” you mean the debug tab, then yes. “car, bus, train” is returned in proper CSV format with commas in between. I just can’t seem to figure out why I can’t export this information to a CSV file.

0 Likes

#6

Just tried both of these options to no avail.

I’m concerned that this issue might be related to the security settings of my computer, and its not an issue with Node-RED. Rather, my computer is denying Node-RED from writing any files to my local drive.

0 Likes

#7

When you start node-red it writes information such as this:

22 May 13:18:58 - [info]

Welcome to Node-RED

22 May 13:18:58 - [info] Node-RED version: v0.18.3
22 May 13:18:58 - [info] Node.js version: v6.11.1
22 May 13:18:58 - [info] Darwin 17.5.0 x64 LE
22 May 13:18:59 - [info] Loading palette nodes

(this is on my mac - it continues…)

If there are any errors then I would expect them to be a line in this with hopefully some information as to why (such as not having permission)

Have you tried writing to somewhere you would definitely have permission to write to such as MyDocs?

0 Likes

#8

I just created a new folder in MyDocs and referenced it in my flow. Node-RED still isn’t writing information to a CSV file.

I am not seeing the start-up information that you mentioned. Perhaps it is because our operating systems are different??? (I am on Windows)

0 Likes

#9

So how to access the log file will depend on how you installed Node-RED.
How is it installed and how do you start Node-RED?

0 Likes

#10

Node-RED was actually pre-installed on a MultiTech Conduit box which I am using to collect different sensor data. I actually completely overlooked an important detail: Node-RED actually isn’t installed on my computer, so it isn’t saving files to my computer. I am not just having issues accessing my Conduit’s files. I am assuming that every Filepath I’ve tried to save files to has been used to save the files into the Conduit…

0 Likes

#11

Yes the file node will save the file locally on the Node-RED server, in your case your MultiTech Conduit box.

0 Likes

#12

Thank you for your help. This looks like a new issue now.

0 Likes

#13

It might be worth looking at the multi tech forum for FAQ-type questions around using Node-RED on their box.

http://www.multitech.net/developer/forums/topic-tag/node-red/

0 Likes