# Read and close data from text/ode file

**URL:** <https://discourse.nodered.org/t/read-and-close-data-from-text-ode-file/21492>\
**Category:** General\
**Created:** [10 February 2020 11:25 UTC](https://discourse.nodered.org/t/read-and-close-data-from-text-ode-file/21492 "2020-02-10T11:25:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pranavthakkar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@pranavthakkar](https://discourse.nodered.org/u/pranavthakkar)\
**Post date:** [10 February 2020 11:25 UTC](https://discourse.nodered.org/t/read-and-close-data-from-text-ode-file/21492/1 "2020-02-10T11:25:42Z")

</div>

Hello there!

I have barcode scanner which is scanning the barcode and currently i'm sending it's value to a text file in RPI also I have used spreadsheet.odb(excel) file.  
My problem is when i scan a barcode it is written in text/odb file but in node red the File node can not give me result unless and until I save the file.

So for every barcode scan i can not get it's latest value. (because i have to save the file and also I don't know what should i do after saving that)

I have seen many option out there but nothing works out, Can any one suggest that how can i Read the text file/spreadsheet and get the latest value and close it with save.

Thanks  
Pranav

---

<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:** [10 February 2020 12:00 UTC](https://discourse.nodered.org/t/read-and-close-data-from-text-ode-file/21492/2 "2020-02-10T12:00:44Z")

</div>

Are you sending it to the file in node-red or by some other means.

---

<div class="post-metadata">

**Author:** ![pranavthakkar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@pranavthakkar](https://discourse.nodered.org/u/pranavthakkar)\
**Post date:** [10 February 2020 12:06 UTC](https://discourse.nodered.org/t/read-and-close-data-from-text-ode-file/21492/3 "2020-02-10T12:06:12Z")

</div>

So my text editor is open always that why my barcode value is written.

For getting latest value i have to close the text editor with save and when I inject in node red I will get latest value

with out saving it will only gives me previous values

---

<div class="post-metadata">

**Author:** ![pranavthakkar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@pranavthakkar](https://discourse.nodered.org/u/pranavthakkar)\
**Post date:** [10 February 2020 12:09 UTC](https://discourse.nodered.org/t/read-and-close-data-from-text-ode-file/21492/4 "2020-02-10T12:09:11Z")

</div>

So I thought let nodered create one text file and open it so if i scan barcode its value will be there and after node red will close the text file and it will save it, so i will fetch the latest value it in node red.

But there is also be a condition that the values need to be deleted so only one value is there all the time.

I don't know is this easy solution or not?  
Please suggest me

---

<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:** [10 February 2020 12:15 UTC](https://discourse.nodered.org/t/read-and-close-data-from-text-ode-file/21492/5 "2020-02-10T12:15:29Z")

</div>

You might be better to use a dashboard text node to scan into, then it will all be under the control of node-red.

---

<div class="post-metadata">

**Author:** ![pranavthakkar](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@pranavthakkar](https://discourse.nodered.org/u/pranavthakkar)\
**Post date:** [10 February 2020 12:19 UTC](https://discourse.nodered.org/t/read-and-close-data-from-text-ode-file/21492/6 "2020-02-10T12:19:02Z")

</div>

I tried it also but the problem is

1. I have to click on dashboard text widget for getting data,(so cursor can blink there)

But For end application I will not have any screen to click on that text box.

1. I also have to clear that textinput so that new text can be entered it.  
without deleting it will write with previous one, and I don't how to do it with this.

So what will be the solution for that?

---

<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:** [10 February 2020 12:31 UTC](https://discourse.nodered.org/t/read-and-close-data-from-text-ode-file/21492/7 "2020-02-10T12:31:15Z")

</div>

As suggested in the other thread you could provide your own text input field using html in a template, you will have to research about html for that. As for clearing the field after actioning it that can be done in node-red by sending it an empty string.

---

<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 April 2020 12:31 UTC](https://discourse.nodered.org/t/read-and-close-data-from-text-ode-file/21492/8 "2020-04-10T12:31:16Z")

</div>

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