How we can export CSV file to local PC(Node-red on IOT2050)

Hi, everyone
I'm study about dashboard I install Node-red on IOT2050.
Now I can't export csv files to my drive D: .
I need to record data on dashboard

  • I already create folder and CSV files for record the data but debug it show the data but in CSV file didn't record.
    Screenshot

How we can check this point ? or we need to use another Node.
Thank you for the answer.
Best regards,

[{"id":"4bcfff86.72b5b","type":"tab","label":"Flow 12","disabled":false,"info":""},{"id":"8f73c1af.7a569","type":"function","z":"4bcfff86.72b5b","name":"","func":"var d = new Date();\nvar date = d.getFullYear()+"/"+d.getDate();\nvar temp = Math.random()*100.0\nvar humid = Math.random()*100.0\nvar data = date+","+temp+","+humid\n\nmsg.payload = data\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":400,"y":220,"wires":[["8d2c1676.e74518"]]},{"id":"e65a1645.e63a08","type":"debug","z":"4bcfff86.72b5b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1010,"y":220,"wires":},{"id":"c63c1f5e.65bc1","type":"ui_button","z":"4bcfff86.72b5b","name":"","group":"59b830e6.0165","order":15,"width":0,"height":0,"passthru":false,"label":"Save","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":250,"y":220,"wires":[["8f73c1af.7a569"]]},{"id":"702a6aa1.28bd04","type":"file","z":"4bcfff86.72b5b","name":"","filename":"D:\Datalog\Datalog1.csv","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":730,"y":220,"wires":[["e65a1645.e63a08"]]},{"id":"8d2c1676.e74518","type":"csv","z":"4bcfff86.72b5b","name":"","sep":",","hdrin":false,"hdrout":"none","multi":"one","ret":"\n","temp":"col1,col2,col3","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":530,"y":220,"wires":[["702a6aa1.28bd04"]]},{"id":"e6f45637.fdb428","type":"inject","z":"4bcfff86.72b5b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":260,"wires":[["8f73c1af.7a569"]]},{"id":"59b830e6.0165","type":"ui_group","name":" ","tab":"5ed2e4a1.1e0b4c","order":1,"disp":true,"width":5,"collapse":false},{"id":"5ed2e4a1.1e0b4c","type":"ui_tab","name":"Main Page","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Hi nuttawut and welcome,

please wrap your code in triple backticks for better readability (How to share code or flow json):

code

Regarding your question, you need to pass the csv node output to a file write node

Okayy , Thank you.

[{"id":"4bcfff86.72b5b","type":"tab","label":"Flow 12","disabled":false,"info":""},{"id":"8f73c1af.7a569","type":"function","z":"4bcfff86.72b5b","name":"","func":"var d = new Date();\nvar date = d.getFullYear()+"/"+d.getDate();\nvar temp = Math.random()*100.0\nvar humid = Math.random()*100.0\nvar data = date+","+temp+","+humid\n\nmsg.payload = data\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":400,"y":220,"wires":[["8d2c1676.e74518"]]},{"id":"e65a1645.e63a08","type":"debug","z":"4bcfff86.72b5b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1010,"y":220,"wires":},{"id":"c63c1f5e.65bc1","type":"ui_button","z":"4bcfff86.72b5b","name":"","group":"59b830e6.0165","order":15,"width":0,"height":0,"passthru":false,"label":"Save","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":250,"y":220,"wires":[["8f73c1af.7a569"]]},{"id":"702a6aa1.28bd04","type":"file","z":"4bcfff86.72b5b","name":"","filename":"D:\Datalog\Datalog1.csv","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":730,"y":220,"wires":[["e65a1645.e63a08"]]},{"id":"8d2c1676.e74518","type":"csv","z":"4bcfff86.72b5b","name":"","sep":",","hdrin":false,"hdrout":"none","multi":"one","ret":"\n","temp":"col1,col2,col3","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":530,"y":220,"wires":[["702a6aa1.28bd04"]]},{"id":"e6f45637.fdb428","type":"inject","z":"4bcfff86.72b5b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":260,"wires":[["8f73c1af.7a569"]]},{"id":"59b830e6.0165","type":"ui_group","name":" ","tab":"5ed2e4a1.1e0b4c","order":1,"disp":true,"width":5,"collapse":false},{"id":"5ed2e4a1.1e0b4c","type":"ui_tab","name":"Main Page","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Okay, I already pass to File(write msg.payload to file) Node and it not record the data
Node-red it install on IOT2050 it need to about the storage or influxDB or not ?
I need to export file current data when we push save button.

It is not clear if you are trying to get data into Node-red from a file (use File In) or get data out of Node-red into a file (File Out).
Or are you trying to update the CSV file?

Sorry , I use File Node write msg.playload to file.
we need to export file to local PC.

The easiest way is to make the file available via an endpoint.

Here is an example: Download a file from node-red using standard nodes (flow) - Node-RED

Okay, First I will trying to make download link.
if it possible to write to file it so nice because we need to daily record.
Pease recommend for me if you have way to fix.
Thank you so much for answer.
Best regards,

Storing data database is the better solution. Then your dashboard could access todays, yesterdays, last weeks data. An additional benefit is you can then also make weekly and monthly reports from the database.

Do you mean that you want to save the downloaded data to a file in the machine running the browser, or do you want to save it to a file on the machine running node-red?

I want to save the downloaded data to a file in the machine running the browser.
We run Node-red on IOT2050 device and we need to monitor and record data to local PC.

If you have some idea please tell me.
Thank you a lot for answer.

Will the machine running the browser always be the same machine? If so, and you have control of that machine, then run node-red in that machine too, then it can pick the data up from the IOT and save the data in files or in a database.

I agree with @Steve-Mcl's suggestion that the best place to store data is in a database not a bunch of CSV files.

Personally I would run the database on a Linux machine within your LAN, but of course Windows and cloud based databases exist too.

You have not given any detail of the "monitor ... data to local PC" processes.
Are you generating reports? Importing to spreadsheets? Just retaining as an audit trail?

Now we use about 3 machines for monitor by local-wifi , Frist we need to save data in files by machine/machine and I havn't been know about the database.

I will try for you recommend all.
Thank so much.