Error spreadsheet

hello every one,

i'm new in node red i would like to use spreadsheet to read value from excel but i'm getting this error , i hope some one can help me

i also tried this

Remove the outer quotes, use / instead of \

Edit: also, I see you are running node-red inside home assistant. One important aspect of this is that home assistant runs in docker and has no access to your computer files.

I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

hi Steve

i past the file inside the directory of home assistant

but receive this i will look at your link

thank you

I think the error speaks for itself.

I don't know home assistant but I do know docker. The path on the host OS (outside) is not necessary the same as the path I the container (inside). You may have to ask on the HA forum how/where files are accessible on the outside and inside of the node-red container.

You could try an exec node and run ls to list the directories inside the container?

my goal was to install node red in a raspberry on the netwerk of my factory.... use spreadshet to read excel file from server and make some automation with PLC S7 1200... now would like to mae some test before to buy everything

Install node-red natively and avoid all the hassle.

Your problem is that when you install Node Red (Presumably you have used the Home Assistant Integration or HACS version) - then it installs it in a seperate container to the HA OS container - so they have no direct link.

You can not therefore easily trasnfer files between them

Craig

thank you very much to every one i installed node red on my pc and now is working

Lesson to take away from this : Don't use HA to run Node RED, install Node RED as it was intended.

Ouch! .... I know! :face_with_open_eyes_and_hand_over_mouth:

Marcus i wanted to do fast but i lost more time.... good lesson

now i ha ve another problem , i need to create a string to open the file, each day the file will have a different name like: myfile_day_month_year

"C:\Users\TD\gravino\myfile_day_month_year.xlsx" how i can create this and give to read node

i use this


but i don't know how to create the string

Hi @Gravino

You can create the filename with a date part relatively easy using a change node.
setting the filename property, and connecting that to the read file node

'C:\\Users\\TD\\gravino\\myfile_' & $moment().tz("Europe/London").format("DD_MM_YYYY") & '.xlsx'

Change the TZ to suite

Import

[{"id":"cd4dc02d262934a7","type":"change","z":"2d7bf6e3.84c97a","name":"","rules":[{"t":"set","p":"filename","pt":"msg","to":"'C:\\\\Users\\\\TD\\\\gravino\\\\myfile_' & $moment().tz(\"Europe/London\").format(\"DD_MM_YYYY\") & '.xlsx'","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":355,"y":1110,"wires":[["9f70665bd58a5d62","3f611c566b7a7a34"]]},{"id":"11363bc975a9dcef","type":"inject","z":"2d7bf6e3.84c97a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":155,"y":1110,"wires":[["cd4dc02d262934a7"]]},{"id":"9f70665bd58a5d62","type":"debug","z":"2d7bf6e3.84c97a","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"filename","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":1060,"wires":[]},{"id":"3f611c566b7a7a34","type":"file in","z":"2d7bf6e3.84c97a","name":"","filename":"filename","filenameType":"msg","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":550,"y":1110,"wires":[["3f0b49eeaa66b584"]]},{"id":"3f0b49eeaa66b584","type":"debug","z":"2d7bf6e3.84c97a","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":1110,"wires":[]}]

In fact you can use JSONata expression direct in the filename field of the file read node, just select J: instead of path

1 Like

If you use year-month-day then the files will sort in date order.

1 Like

Hi@Marcus
thank you it works perfectly, please can you tell me where i can stugy a bit of j

Best source is here : https://jsonata.org/

There is also a playground on there, but do note : Node RED has added “extras” to the engine.

The internal JSONata editor is pretty helpful also

And as mentioned by @E1cid, you can use JSONata directly in the file read node.

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