You can use this flow
[{"id":"733f8b22.bbb37c","type":"file","z":"5008b27.8f1b2cc","name":"log sensor data","filename":"/home/pi/Desktop/pruebasensores15072020/pruebastiempos2.json","appendNewline":false,"createDir":true,"overwriteFile":"false","x":800,"y":408,"wires":[[]]},{"id":"8e07289b.0d29f","type":"function","z":"5008b27.8f1b2cc","name":"Modify Payload Changed","func":"var local=context.get('local') || {};\nvar topic=msg.topic;\nvar last_payload=\"\";\nif (local[topic]===undefined)//test exists\n{\n node.log(\"not defined \"+topic);\n payload=msg.payload;\n}\nelse{\n \nlast_payload=local[topic];\n}\n\nnode.log(\"last payload \"+ last_payload);\nnode.log(\"This payload \"+ msg.payload);\n//msg.payload=JSON.stringify(payload);\nnode.log(JSON.stringify(local));\n//\nif (msg.payload==last_payload)\n{\nnode.log(\"same data\"+topic);\nreturn null;\n}\nelse{\nlocal[topic]=msg.payload;\nnode.log(local);\ncontext.set('local',local);\n}\n//\nvar d = new Date();\nvar t = d.getTime();\npayload={\"time\":t,\"payload\":msg.payload,\"topic\":msg.topic};\n//msg.payload=JSON.stringify(payload);\nmsg.payload=payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":410,"y":468,"wires":[[]]},{"id":"fd685e89.5a53f","type":"function","z":"5008b27.8f1b2cc","name":"All data","func":"var getvalueone = global.get(\"valueone\");\nvar getvaluetwo = msg.payload;\nvar d = new Date();\nvar date = d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate();\nvar time = d.getHours() + \":\" + d.getMinutes() + \":\" + d.getSeconds();\nvar dateTime = date+' '+time;\npayload={\"time\":dateTime,\"value2\":getvaluetwo,\"value1\":getvalueone};\nmsg.payload=payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":460,"y":408,"wires":[["c74fe8d7.bf7a5","8289dbaf.a3a758"]]},{"id":"1e192bb8.b8c4bc","type":"function","z":"5008b27.8f1b2cc","name":"","func":"var valueone =msg.payload;\nglobal.set('valueone',valueone);\nmsg.payload=valueone;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":300,"y":288,"wires":[["e5ae1637.60781"]]},{"id":"e5ae1637.60781","type":"debug","z":"5008b27.8f1b2cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":470,"y":288,"wires":[]},{"id":"b30c3c03.adb9b","type":"inject","z":"5008b27.8f1b2cc","name":"messagenumerone","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"messagenumerone","payloadType":"str","x":90,"y":288,"wires":[["1e192bb8.b8c4bc"]]},{"id":"8e39c06f.ac1ae8","type":"function","z":"5008b27.8f1b2cc","name":"","func":"var valuetwo =msg.payload;\nmsg.payload=valuetwo;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":300,"y":408,"wires":[["fd685e89.5a53f"]]},{"id":"d7c82caa.7fdb48","type":"inject","z":"5008b27.8f1b2cc","name":"messagenumertwo","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"messagenumertwo","payloadType":"str","x":90,"y":408,"wires":[["8e39c06f.ac1ae8"]]},{"id":"c74fe8d7.bf7a5","type":"csv","z":"5008b27.8f1b2cc","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":624,"y":408,"wires":[["733f8b22.bbb37c"]]},{"id":"8289dbaf.a3a758","type":"debug","z":"5008b27.8f1b2cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":470,"y":348,"wires":[]}]
This writes it as csv, you can directly open it in excel