# Help with parsing a CSV file

**URL:** https://discourse.nodered.org/t/help-with-parsing-a-csv-file/97569
**Category:** General
**Created:** [12 June 2025 08:56 UTC](https://discourse.nodered.org/t/help-with-parsing-a-csv-file/97569 "2025-06-12T08:56:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [12 June 2025 08:56 UTC](https://discourse.nodered.org/t/help-with-parsing-a-csv-file/97569/1 "2025-06-12T08:56:41Z")

</div>

Another project. 😢

I need to parse a csv file to a formatted text file for my dhcp list.

All ops on THIS machine.

THIS THIS.

I tried - and failed - to read the file from my `home` directory. (Which is kind of good)  
So I put it in my `node-red/public` directory.

But still can't get to it.

In the `read file` node, what do I need to put?

I do access other files on this machine but for reasons unknown, it isn't working.

I shall buzz off and check - again.  
But I fear I will more help further down the line anyway.  
So may as well ask now.  
😉

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [12 June 2025 09:03 UTC](https://discourse.nodered.org/t/help-with-parsing-a-csv-file/97569/2 "2025-06-12T09:03:31Z")

</div>

Ok, I stuffed up with HOW to get the filename to the node.

Got that working.

Now I'm working on how to ..... split up the rows/columns and sort of get them back to cells then parse the cells and output another text file.

I'll edit some of the data and post a bit of it to show - as I can't expect _you_ to know it.

But that's where I'm at now.

Part of the file.

```auto
,,,,,,,,,,,,,,
,,,,,,,,,,,,,,
,,,,,,DO NOT EDIT,,,,,,,,
,,,,,,,,,,,,,,
,,,,,,,,,,,,,,
,17,MAIN,,,12,MEDIA,,,13,WINDOWS,,,16,STORAGE
IP,Device,MAC,,IP,Device,MAC,,IP,Device,MAC,,IP,Device,MAC
1,Router,,,1,Router,,,1,Router,,,1,Router,
2,Switch,MAC,,2,Switch,MAC,,2,Switch,28-87-BA-F3-B9-43,,2,Switch,MAC
3,Linksys,,,3,,,,3,,,,3,,
4,TP 1016,MAC,,4,,,,4,,,,4,,
5,,,,5,Shield,MAC:7e,,5,,,,5,WIB,
6,NUC,NAC,,6,TIVX,MAC,,6,,,,6,The Shed,MAC
7,Nas-T-Nuc,,,7,Beyonwiz,FAULTY?,,7,,,,7,Outhouse,MAC
8,,,,8,,,,8,,,,8,BARN (eth2),90:09:D0:4A:B5:64
9,TV,MAC,,9,,,,9,,,,9,(moved to MEDIA network),
10,,,,10,,,,10,,,,10,,
11,,,,11,,,,11,Big P.C.,MAC,,
12,,,,12,,,,12,Printer,30:05:5c:4e:72:0c,,12,,
13,,,,13,,,,13,Blacksheep,PENDING,,13,,
14,,,,14,,,,14,Other P.C.,PENDING,,14,,
15,,,,15,,,,15,,,,15,,
16,,,,16,,,,16,,,,16,,
17,,,,17,,,,17,,,,17,,
18,,,,18,,,,18,,,,18,,
19,,,,19,,,,19,,,,19,,
20,,,,20,,,,20,,,,20,,
21,XBMC,MAC,,21,,,,21,,,,21,,
22,MusicPi,MAC,,22,,,,22,,,,22,,
23,BedPi,MAC,,23,,,,23,,,,23,,
24,IR Bridge,MAC,,24,,,,24,,,,24,,
25,,,,25,,,,25,,,,25,,
26,PiFace,,,26,,,,26,,,,26,,
27,,,,27,,,,27,,,,27,,
28,,,,28,,,,28,,,,28,,
29,,,,29,,,,29,,,,29,,
30,EyeSpyPi,,,30,,,,30,,,,30,,
31,CameraPi,,,31,,,,31,,,,31,,
32,PortaPi,MAC,,32,,,,32,,,,32,,
33,TelePi,MAC,,33,,,,33,,,,33,,
34,BeefPi,MAC,,34,,,,34,,,,34,,
35,,,,35,,,,35,,,,35,,
36,,,,36,,,,36,,,,36,,
37,,,,37,,,,37,,,,37,,
38,,,,38,,,,38,,,,38,,
39,TimePi,MAC,,39,,,,39,,,,39,,
40,,,,40,,,,40,,,,40,,
41,,,,41,,,,41,,,,41,,
42,,,,42,,,,42,,,,42,,

```

I want to extract the IP, MAC and Name.

Help please.

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [12 June 2025 09:47 UTC](https://discourse.nodered.org/t/help-with-parsing-a-csv-file/97569/3 "2025-06-12T09:47:45Z")

</div>

This looks like a difficult file to parse.

There are only three lines containing a MAC address, and those are not all in the same column.  
I don't see any IP addresses at all.

Where does the file come from?  
I'd probably try and rationalise the contents before struggling to parse it.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [12 June 2025 09:57 UTC](https://discourse.nodered.org/t/help-with-parsing-a-csv-file/97569/4 "2025-06-12T09:57:48Z")

</div>

Thanks.

Sometimes I surprise myself.

Yes,a lot of messing around but I got it working.

SORRY.

But all good.

I only did a small part as it is/was painful _masking_ all the MAC addresses.  
(Privacy and all that)

It is a spreadsheet I made and need to extract all the assigned IP addresses because of things recently happened.

---

<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: [26 June 2025 09:58 UTC](https://discourse.nodered.org/t/help-with-parsing-a-csv-file/97569/5 "2025-06-26T09:58:31Z")

</div>

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