# How to read a csv file that is constantly updated

**URL:** <https://discourse.processing.org/t/how-to-read-a-csv-file-that-is-constantly-updated/39372>\
**Category:** Beginners\
**Created:** [October 20, 2022, 3:45pm UTC](https://discourse.processing.org/t/how-to-read-a-csv-file-that-is-constantly-updated/39372 "2022-10-20T15:45:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ALCOHOLICBRY](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@ALCOHOLICBRY](https://discourse.processing.org/u/ALCOHOLICBRY)\
**Post date:** [October 20, 2022, 3:45pm UTC](https://discourse.processing.org/t/how-to-read-a-csv-file-that-is-constantly-updated/39372/1 "2022-10-20T15:45:04Z")

</div>

This is the goal I want to achieve:  
As soon as I write the text in a csv file and save it, processing will display it instantly.

But now, if I save the csv file while running the code, Error will show up.

Here is the code:

> Table table;  
> void setup() {  
> }  
> void draw(){  
> table = loadTable(“input.csv”, “header”);  
> for (TableRow row : table.rows()) {  
> int id = row.getInt(“id”);  
> String species = row.getString(“species”);  
> String name = row.getString(“name”);  
> println(name + " (" + species + ") has an ID of " + id);  
> }  
> }

And the Error:

> java.io.IOException: 程序無法存取檔案，因為另一個程序已鎖定檔案的一部分。  
> at java.base/java.io.FileInputStream.readBytes(Native Method)  
> at java.base/java.io.FileInputStream.read(FileInputStream.java:276)  
> at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:282)  
> at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:343)  
> at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:270)  
> at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:313)  
> at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188)  
> at java.base/java.io.InputStreamReader.read(InputStreamReader.java:177)  
> at java.base/java.io.BufferedReader.fill(BufferedReader.java:162)  
> at java.base/java.io.BufferedReader.read(BufferedReader.java:183)  
> at processing.data.Table.parse(Table.java:398)  
> at processing.data.Table.(Table.java:168)  
> at processing.core.PApplet.loadTable(PApplet.java:5721)  
> at sketch\_221020a.draw(sketch\_221020a.java:24)  
> at processing.core.PApplet.handleDraw(PApplet.java:2131)  
> at processing.awt.PSurfaceAWT$9.callDraw(PSurfaceAWT.java:1386)  
> at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:356)  
> NullPointerException

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [October 20, 2022, 4:32pm UTC](https://discourse.processing.org/t/how-to-read-a-csv-file-that-is-constantly-updated/39372/2 "2022-10-20T16:32:35Z")

</div>

Hi

> **[Data](https://processing.org/tutorials/data/)**
>
> Learn the basics of working with data feeds in Processing.

> **[Reference](https://processing.org/reference/loadTable_.html)**
>
> Reads the contents of a file or URL and creates an Table object with its values. If a file is specified, it must be located in the sketch's "data" folder. The filename parameter can also be a URL to a…
