# Reading single row in csv file

**URL:** <https://discourse.nodered.org/t/reading-single-row-in-csv-file/31432>\
**Category:** General\
**Created:** [11 August 2020 11:02 UTC](https://discourse.nodered.org/t/reading-single-row-in-csv-file/31432 "2020-08-11T11:02:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ward](https://avatars.discourse-cdn.com/v4/letter/w/439d5e/32.png) [@Ward](https://discourse.nodered.org/u/Ward)\
**Post date:** [11 August 2020 11:02 UTC](https://discourse.nodered.org/t/reading-single-row-in-csv-file/31432/1 "2020-08-11T11:02:41Z")

</div>

Hi,

Is it possible to select and read a single row in a csv file?

I have a csv document with the text of all my alarms (automatic generated so that's why i start from this file source) and now i want only read the row with the corresponding alarm. So for example if my input for temperature alarm is high i want to read row 6 of the csv file and log it in a database.

I only find a way to read the whole file.

Thanks at advance!  
Kind regards,  
Ward

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [11 August 2020 20:51 UTC](https://discourse.nodered.org/t/reading-single-row-in-csv-file/31432/2 "2020-08-11T20:51:26Z")

</div>

You don't have to read all the lines, just let them all be send and use a switch node to filter for your needs.

See this example flow:

```auto
[{"id":"73e5e95c.050fe8","type":"csv","z":"711169bd.c68438","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":434,"y":312,"wires":[["27bdaada.685e9e","7f507812.bf37d8"]]},{"id":"9a9ed6a0.88d5b8","type":"inject","z":"711169bd.c68438","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":154,"y":312,"wires":[["f1b006d3.ab7888"]]},{"id":"f1b006d3.ab7888","type":"function","z":"711169bd.c68438","name":"","func":"data = `date,temperature\n202008110900,20\n202008111000,26\n202008111100,25\n202008111200,27\n202008111300,21\n`\nreturn {payload:data};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":300,"y":312,"wires":[["73e5e95c.050fe8"]]},{"id":"9916d5e5.46f21","type":"debug","z":"711169bd.c68438","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":838,"y":312,"wires":[]},{"id":"27bdaada.685e9e","type":"switch","z":"711169bd.c68438","name":"Temperature > 25 ?","property":"payload.temperature","propertyType":"msg","rules":[{"t":"gt","v":"25","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":618,"y":312,"wires":[["9916d5e5.46f21"]]},{"id":"7f507812.bf37d8","type":"debug","z":"711169bd.c68438","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":578,"y":240,"wires":[]}]

```

---

<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:** [10 October 2020 20:51 UTC](https://discourse.nodered.org/t/reading-single-row-in-csv-file/31432/3 "2020-10-10T20:51:41Z")

</div>

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