Reading files into ui-table

Newbie so still trying to understand the system.
I've tried using the example data from ui-table written into files and used file reader to input to ui-table - it creates a blank table. The examples using inject work fine.
Can someone please provide ANY example of reading a file directly (or through a function) into ui-table?
Simple version just two items with one variable each would suffice.
Thanks

I always check if there are any examples included with each new contrib I install.

1 Like

It will depend on what you file looks like of course... but if it is something like a CSV file then maybe the CSV node will parse it into a table and if you set that to output a single array then you may be able to feed that straight into a ui_table node

file - /tmp/a.csv

Sensor,Temp,Humidity
A1,22,58
B1,23,55
C2,19,62

[{"id":"1214ce9370f52ffa","type":"inject","z":"ba9351cf.2e3e1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":440,"wires":[["17a96824507f88f8"]]},{"id":"17a96824507f88f8","type":"file in","z":"ba9351cf.2e3e1","name":"","filename":"/tmp/a.csv","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":330,"y":440,"wires":[["2918850eb505b43b"]]},{"id":"2918850eb505b43b","type":"csv","z":"ba9351cf.2e3e1","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":490,"y":440,"wires":[["f76e0e9aa06e98f3"]]},{"id":"f76e0e9aa06e98f3","type":"ui_table","z":"ba9351cf.2e3e1","group":"276245e.5e9fbba","name":"","order":3,"width":0,"height":0,"columns":[],"outputs":0,"cts":false,"x":630,"y":440,"wires":[]},{"id":"276245e.5e9fbba","type":"ui_group","name":"Group1","tab":"b667c473.aed508","order":2,"disp":true,"width":"10","collapse":false},{"id":"b667c473.aed508","type":"ui_tab","name":"Tab1","icon":"dashboard","disabled":false,"hidden":false}]

1 Like

I had tried to do exactly the same thing, and it didn't work.
But your example helped me find the problem.
I had set the csv output to the default - a message per row, instead of a single message [array]
Thanks!

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