# How get only one value from a CSV file

**URL:** <https://discourse.nodered.org/t/how-get-only-one-value-from-a-csv-file/65444>\
**Category:** General\
**Created:** [21 July 2022 19:35 UTC](https://discourse.nodered.org/t/how-get-only-one-value-from-a-csv-file/65444 "2022-07-21T19:35:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Disaile12](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@Disaile12](https://discourse.nodered.org/u/Disaile12)\
**Post date:** [21 July 2022 19:35 UTC](https://discourse.nodered.org/t/how-get-only-one-value-from-a-csv-file/65444/1 "2022-07-21T19:35:58Z")

</div>

Hello, I have a query. I am currently graphing a data series from a .CSV file and everything is perfect, but now I need to grab the last recorded value of a single column in particular. The file contains 4 columns, A,B,C,D but I only require the last recorded value of column C for example, and then display it on the dash board with the "text" node. In this file the data is stored from the oldest to the most current. I hope you help me, regards.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/1/91a49a385e7291b8dc71740b5bba3a1a8601ceb9.png)

---

<div class="post-metadata">

**Author:** ![3dimensional](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/3dimensional/32/64992_2.png) [@3dimensional](https://discourse.nodered.org/u/3dimensional)\
**Post date:** [21 July 2022 20:32 UTC](https://discourse.nodered.org/t/how-get-only-one-value-from-a-csv-file/65444/2 "2022-07-21T20:32:10Z")

</div>

Hi, maybe this flow helps you to implement the solution. Please compare the csv node configuration, maybe you have to implement a second csv node as a parallell process if configuration differs.

```auto
[{"id":"62d4cd6ea399baad","type":"tab","label":"NodeRED Forum","disabled":false,"info":"","env":[]},{"id":"f5d8a8ad2ece901b","type":"inject","z":"62d4cd6ea399baad","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":320,"wires":[["0d45f18f95325db3"]]},{"id":"0d45f18f95325db3","type":"template","z":"62d4cd6ea399baad","name":"CSV Mock","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"A,B,C,D\n1,0,0,0\n0,0,0,0\n\"\",'',0,text\n1,2,Last Entry,4","output":"str","x":510,"y":320,"wires":[["6f8992d43ba9f6b8"]]},{"id":"6f8992d43ba9f6b8","type":"csv","z":"62d4cd6ea399baad","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":false,"include_empty_strings":true,"include_null_values":true,"x":650,"y":320,"wires":[["439c81a9c1ec0ec1","23179cba66629e22"]]},{"id":"ea5df47ef2ac3295","type":"debug","z":"62d4cd6ea399baad","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1020,"y":320,"wires":[]},{"id":"439c81a9c1ec0ec1","type":"function","z":"62d4cd6ea399baad","name":"Get Last Array Element","func":"var rows = msg.payload;\nvar lastRow = rows.pop();\nmsg.payload = lastRow.C;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":830,"y":320,"wires":[["ea5df47ef2ac3295"]]},{"id":"ad9629160c1416a5","type":"comment","z":"62d4cd6ea399baad","name":"Should ","info":"","x":350,"y":280,"wires":[]},{"id":"23179cba66629e22","type":"debug","z":"62d4cd6ea399baad","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":920,"y":260,"wires":[]}]

```

Cheers

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [22 July 2022 03:04 UTC](https://discourse.nodered.org/t/how-get-only-one-value-from-a-csv-file/65444/3 "2022-07-22T03:04:12Z")

</div>

There is also this thread that would give you some valuable pointers in how to achieve it

> [@CSV file - last line require](https://discourse.nodered.org/t/csv-file-last-line-require/11153):
>
> Hello, This is my first post, so let me introduce myself. My name is Robert and I am from Poland, I just start my adventure with node red, so forgive me some illy questions. I have a CSV file from dropbox. The file is stored on dropbox by Leaf Spy apk. and contains data from my electric car. The file is an aplication log, so it is biger and biger. I need the last line of this file. Could you help me, how to extract the last line? This is my simple flow, but csv function gives me all data in sp…

Craig

---

<div class="post-metadata">

**Author:** ![Disaile12](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@Disaile12](https://discourse.nodered.org/u/Disaile12)\
**Post date:** [25 July 2022 15:40 UTC](https://discourse.nodered.org/t/how-get-only-one-value-from-a-csv-file/65444/4 "2022-07-25T15:40:17Z")

</div>

Hello, I implemented this flow with the corresponding modifications, but when running it the node red was blocked and I could not reconnect. I had to delete the root flow to be able to access it again, I don't know what could have happened. ☹

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 July 2022 16:08 UTC](https://discourse.nodered.org/t/how-get-only-one-value-from-a-csv-file/65444/5 "2022-07-25T16:08:24Z")

</div>

If you make a mistake in the flow which causes node-red flows to lock up for some reason, you can start node-red using  
`node-red --safe`  
which will start the editor without starting the flows. Then you can fix the problem and deploy to start the flows running.

---

<div class="post-metadata">

**Author:** ![Disaile12](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@Disaile12](https://discourse.nodered.org/u/Disaile12)\
**Post date:** [25 July 2022 16:22 UTC](https://discourse.nodered.org/t/how-get-only-one-value-from-a-csv-file/65444/6 "2022-07-25T16:22:20Z")

</div>

Thank you for your reply. I am trying to resolve the main issue. ☹

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 September 2022 16:23 UTC](https://discourse.nodered.org/t/how-get-only-one-value-from-a-csv-file/65444/7 "2022-09-23T16:23:18Z")

</div>

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