# Edit CSV files in a flow?

**URL:** <https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392>\
**Category:** General\
**Created:** [18 December 2021 13:50 UTC](https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392 "2021-12-18T13:50:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [18 December 2021 13:50 UTC](https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392/1 "2021-12-18T13:50:21Z")

</div>

Is it possible to edit CSV files in a node red flow? Or browser somehow?

I am interacting with another building automation type platform with Node Red and for each device on this separate platform there is a CSV file containing the device "points" for like temperature sensors, valve/damper actuators on an HVAC system.

Is there a way to edit CSV files in Node Red without having to use Nano from Linux terminal as shown in the screenshot below.?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/2/f2836e397d3954650ab4a3aa2a25129e77ab546f.png)

One other option is I think this platform can also use JSON objects to represent devices/points like the screenshot above instead of CSV which Ill have to look into if JSON files can be edited in Node Red flows?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 December 2021 13:56 UTC](https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392/2 "2021-12-18T13:56:02Z")

</div>

Lots of ways to interact with tabular data which is all that a CSV file is.

The simplest though is to convert to JSON, process then convert back if you need to put it back to CSV.

Other things you could do would be to load the CSV to a database and process in the db itself.

Really depends on what you need out of it.

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [18 December 2021 14:16 UTC](https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392/3 "2021-12-18T14:16:47Z")

</div>

So when [setting up this other platform](https://volttron.readthedocs.io/en/main/) you discover BACnet devices in a building on a LAN by running a Python file. The script auto compiles each BACnet device as a CSV file where you can edit the points associated with each BACnet device via trimming down the CSV files to only capture the "points" you need.

Hopefully that makes sense but the VOLTTRON framework requires a CSV files for each device (framework creates this automatically by auto discovering the BACnet network)

Then once you have trimmed down the CSV files you load the files into a memory (called the VOLTTRON configuration store) by running some commands from Linux terminal.

I was curious if there is a way to do the trimming of the CSV files in Node Red without using Nano. I do think I can use JSON instead of CSV with VOLTTRON, where I may look into that... Trim down JSON files representing each BACnet device instead of a CSV file be easier and something I can do in Node Red flow???

Ultimately I can interact with VOLTTRON from Node Red via REST API to retrieve sensor values, etc.

---

<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:** [18 December 2021 14:17 UTC](https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392/4 "2021-12-18T14:17:08Z")

</div>

Have a look at the CSV node, that will convert the data in a javascript object. Then you can manipulate and convert it back to CSV. You can use the File nodes to read and write the CSV data.

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [18 December 2021 17:39 UTC](https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392/5 "2021-12-18T17:39:49Z")

</div>

@Colin I can get this to work, at least I can read the csv file and see it in the debug window. maybe this is a silly idea but did you mention I could read a csv file and be able to edit the contents?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd576e5afc46c6e2d0b8517e73f708ccabd137f3.png)

What would be cool is if I could read the CSV file and edit it like a text editor or Excel, and then write it back to the same directory that the file was read from. Thanks for any tips not a lot of wisdom here.

If tools don't exist and someone is interested in creating something, how do people go about that? Could something like this be created in React or Vue.js and then publish as a `node` for the Node Red community?

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [18 December 2021 18:00 UTC](https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392/6 "2021-12-18T18:00:05Z")

</div>

Maybe just using a text editor directly is best and easiest. Like nodepad++

[![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/e/1e2127303d3ec92a2e343860cad673f33f0bbd98.jpeg "Raspberry PI - Editing files with Notepad++ over SSH and VNC copy & paste") ](https://www.youtube.com/watch?v=m8nyRXQaf74)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 December 2021 18:46 UTC](https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392/7 "2021-12-18T18:46:00Z")

</div>

> [@bbartling](#):
>
> I was curious if there is a way to do the trimming of the CSV files in Node Red without using Nano

Yes you can.

By the way, at the risk of raising the ire of people on this Node-RED forum, if you are already into Python, it has most excellent tools for manipulating tabular data.

For Node-RED, your flow is 1/2 way there. It gets you the tabular data into a JavaScript object and you now need to manipulate that. You can do that various ways in Node-RED bepending on what you actually need to do to the data.

Once you've changed the data, you will simply convert the JavaScript data back into CSV form and write it back tot he same or a new CSV file.

> [@bbartling](#):
>
> edit it like a text editor or Excel

You _can_ do that with Node-RED as well. Having converted to a javascript object as you've already done, you can use the ui\_table node which you can use to create a table editor user interface in Dashboard.

> [@bbartling](#):
>
> Maybe just using a text editor directly is best and easiest.

Well, then you will always have to do it by hand. And that setup will be pretty slow and clunky on most Pi's.

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [19 December 2021 13:42 UTC](https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392/8 "2021-12-19T13:42:07Z")

</div>

Thank you so much for this.... Very helpful

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [19 December 2021 15:35 UTC](https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392/9 "2021-12-19T15:35:38Z")

</div>

> [@TotallyInformation](#):
>
> ui\_table node

Im getting a little further:  
[https://stackoverflow.com/questions/70412835/render-csv-file-in-node-red-flow](https://stackoverflow.com/questions/70412835/render-csv-file-in-node-red-flow)

---

<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:** [2 January 2022 15:36 UTC](https://discourse.nodered.org/t/edit-csv-files-in-a-flow/55392/10 "2022-01-02T15:36:35Z")

</div>

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