# Read file and split line into separate values

**URL:** <https://discourse.nodered.org/t/read-file-and-split-line-into-separate-values/92049>\
**Category:** General\
**Created:** [29 September 2024 14:01 UTC](https://discourse.nodered.org/t/read-file-and-split-line-into-separate-values/92049 "2024-09-29T14:01:55Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [29 September 2024 14:27 UTC](https://discourse.nodered.org/t/read-file-and-split-line-into-separate-values/92049/2 "2024-09-29T14:27:50Z")

</div>

Please use triple backticks

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

You can edit and correct your post by clicking the pencil ✏ icon.

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

here is an example of how to get the last line values into a payload object

```auto
[{"id":"73e4e16.4d9742","type":"inject","z":"fa6e2728cb6426c9","name":"Inject","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":270,"y":100,"wires":[["0edd8736d88f90c4"]]},{"id":"0edd8736d88f90c4","type":"template","z":"fa6e2728cb6426c9","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"plain","template":"larry curly mo 20 40\nlarry curly mo 20 40\nlarry curly mo 20 40","output":"str","x":440,"y":100,"wires":[["892ca195.f46cb"]]},{"id":"892ca195.f46cb","type":"csv","z":"fa6e2728cb6426c9","name":"","spec":"rfc","sep":" ","hdrin":false,"hdrout":"none","multi":"mult","ret":"\\r\\n","temp":"value1,value2,value3,temp,humidity","skip":"0","strings":true,"include_empty_strings":"","include_null_values":true,"x":590,"y":100,"wires":[["a5cc343d4581e9bf"]]},{"id":"a5cc343d4581e9bf","type":"change","z":"fa6e2728cb6426c9","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[-1]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":100,"wires":[["14ddc802.a51cb8"]]},{"id":"14ddc802.a51cb8","type":"debug","z":"fa6e2728cb6426c9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":910,"y":140,"wires":[]}]

```

The objects names can be set by adding them in the column field of the csv node, or a msg.columns with a list of names in a string format separated by commas.

---

_[View the full topic](https://discourse.nodered.org/t/read-file-and-split-line-into-separate-values/92049)._
