# Import data from text file to sqlite database?

**URL:** <https://discourse.nodered.org/t/import-data-from-text-file-to-sqlite-database/26019>\
**Category:** General\
**Created:** [3 May 2020 20:55 UTC](https://discourse.nodered.org/t/import-data-from-text-file-to-sqlite-database/26019 "2020-05-03T20:55:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asdf123](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@asdf123](https://discourse.nodered.org/u/asdf123)\
**Post date:** [3 May 2020 20:55 UTC](https://discourse.nodered.org/t/import-data-from-text-file-to-sqlite-database/26019/1 "2020-05-03T20:55:02Z")

</div>

Hello,

Can you help me with sqlite database? How can I import data from text file into sqlite database?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [3 May 2020 23:54 UTC](https://discourse.nodered.org/t/import-data-from-text-file-to-sqlite-database/26019/2 "2020-05-03T23:54:02Z")

</div>

First you have to determine the structure of the database and how you want to store the data. I.e. build a schema. If you don’t know what that means then the first thing you should do is take an SQLite tutorial [https://www.tutorialspoint.com/sqlite/index.htm](https://www.tutorialspoint.com/sqlite/index.htm)

Next you will have to read the text file, you can use the 1st file-in` node for that.

Then you will need to split the record coming in from the file in node - use the `splits node for that. Then you have to format the sql to store the data, I’d use a `template node for that. And finally insert the data into the database with the `SQLite node.

In the flow tab search for `SQLite` and you will find the node and a sample flow you can play with.

---

<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 July 2020 23:54 UTC](https://discourse.nodered.org/t/import-data-from-text-file-to-sqlite-database/26019/3 "2020-07-02T23:54:06Z")

</div>

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