# Read csv file dynamically

**URL:** <https://discourse.nodered.org/t/read-csv-file-dynamically/85441>\
**Category:** General\
**Created:** [12 February 2024 09:08 UTC](https://discourse.nodered.org/t/read-csv-file-dynamically/85441 "2024-02-12T09:08:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![PRABHAKAR82](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@PRABHAKAR82](https://discourse.nodered.org/u/PRABHAKAR82)\
**Post date:** [12 February 2024 09:08 UTC](https://discourse.nodered.org/t/read-csv-file-dynamically/85441/1 "2024-02-12T09:08:10Z")

</div>

![csv](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/5/6557e40fa570dc00f6ed2e26d67871e1a1379944.png)  
 ![csv2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/7/f7af65fc8f923fc9adb505f2f267c99aa6c2083f.png)

I am able to read CSV file, but my problem is that after few times new CSV file is generated in the same folder with name VT3\_CUP\_xxxx\_0001.csv. So Everytime I have to read newly generated CSV.My question is How I read the newly generated CSV file automatically.

here xxxx in file name is timestamp of when CSV is generated.csv is generated by another system

---

<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:** [12 February 2024 09:27 UTC](https://discourse.nodered.org/t/read-csv-file-dynamically/85441/2 "2024-02-12T09:27:46Z")

</div>

Have a look at the "watch" node.

---

<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:** [12 February 2024 09:28 UTC](https://discourse.nodered.org/t/read-csv-file-dynamically/85441/3 "2024-02-12T09:28:56Z")

</div>

You could use a Watch node, which is one of the built-in nodes, to tell you that the new file is available for reading.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 February 2024 09:46 UTC](https://discourse.nodered.org/t/read-csv-file-dynamically/85441/4 "2024-02-12T09:46:08Z")

</div>

At a guess, you process the file then move it or rename it?

You could simply use `node-red-contrib-fs-ops` to scan the dir, get a list of outstanding \*.csv files, process them 1 at a time, then move/rename them.

You can use the watch or simply do a dir listing once per minute (or so) - if CSV files exist, then you have more to process.

One thing to you may need to be mindful of is reading a file that is being written.

---

<div class="post-metadata">

**Author:** ![PRABHAKAR82](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@PRABHAKAR82](https://discourse.nodered.org/u/PRABHAKAR82)\
**Post date:** [12 February 2024 10:18 UTC](https://discourse.nodered.org/t/read-csv-file-dynamically/85441/5 "2024-02-12T10:18:41Z")

</div>

As you said I install node-red-contrib-fs-ops, but I am confused how to use that. Have you some sample flow?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 February 2024 10:23 UTC](https://discourse.nodered.org/t/read-csv-file-dynamically/85441/6 "2024-02-12T10:23:55Z")

</div>

Plenty [here](https://discourse.nodered.org/search?context=topic&context_id=85441&q=Node-red-contrib-fs-ops%20order%3Alatest&skip_context=true)

And [here](https://flows.nodered.org/search?term=Fs-ops&type=flow&type=collection)

---

<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 February 2024 10:24 UTC](https://discourse.nodered.org/t/read-csv-file-dynamically/85441/7 "2024-02-26T10:24:09Z")

</div>

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