# Import Question

**URL:** <https://discourse.joplinapp.org/t/import-question/24427>\
**Category:** Support\
**Created:** [15 March 2022 12:04 UTC](https://discourse.joplinapp.org/t/import-question/24427 "2022-03-15T12:04:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kai](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/kai/32/16967_2.png) [@Kai](https://discourse.joplinapp.org/u/Kai)\
**Post date:** [15 March 2022 12:04 UTC](https://discourse.joplinapp.org/t/import-question/24427/1 "2022-03-15T12:04:05Z")

</div>

Dear all,

I have a plain ASCII file containing a number of lines of text. How do I import this file in such a way that each line ends up as a separate note or todo (importing the file as an .md-file results in the entire file ending up as a single note).

Regards,  
kai.

Joplin 2.7.14 (prod, linux)

Client-ID: 3708fbfebb3646c787c57619e7200257  
Sync-Version: 3  
Profil-Version: 41  
Unterstützter Schlüsselbund: Nein

Revision: 98fba37

---

<div class="post-metadata">

**Author:** ![Marph](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/marph/32/10800_2.png) [@Marph](https://discourse.joplinapp.org/u/Marph)\
**Post date:** [15 March 2022 16:23 UTC](https://discourse.joplinapp.org/t/import-question/24427/2 "2022-03-15T16:23:26Z")

</div>

Hi,

you could do that by leveraging [joplins data API](https://joplinapp.org/api/references/rest_api/). A python script could look like:

```auto
from joppy.api import Api

api = Api(token="YOUR_TOKEN")

notebook_id = api.add_notebook(title="Imported Notes")

with open("/path/to/text/file.txt") as infile:
    for line_index, line_content in enumerate(infile.readlines()):
        api.add_note(
            title=f"Line {line_index}",
            body=line_content,
            parent_id=notebook_id
        )

```

If you want to try it, make sure to use a small sample file first.

---

<div class="post-metadata">

**Author:** ![Kai](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/kai/32/16967_2.png) [@Kai](https://discourse.joplinapp.org/u/Kai)\
**Post date:** [16 March 2022 13:48 UTC](https://discourse.joplinapp.org/t/import-question/24427/3 "2022-03-16T13:48:57Z")

</div>

hi,  
thanks for the feedback. I was actually hoping for something easier/quicker; perhaps something I had overlooked in the IMPORT functionality, so I don't know whether I would like to run something like this everytime I need to import; but it's an interesting solution; thanks.

Regards,  
kai.

---

<div class="post-metadata">

**Author:** ![Daeraxa](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/daeraxa/32/6172_2.png) [@Daeraxa](https://discourse.joplinapp.org/u/Daeraxa)\
**Post date:** [16 March 2022 14:01 UTC](https://discourse.joplinapp.org/t/import-question/24427/4 "2022-03-16T14:01:11Z")

</div>

If you need to split the file first then linux has all kinds of tools for it.  
Something like a basic file per literal line:  
`split -l 1-d --additional-suffix=.md big_file.md new_file`

Then import those.

---

<div class="post-metadata">

**Author:** ![Kai](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/kai/32/16967_2.png) [@Kai](https://discourse.joplinapp.org/u/Kai)\
**Post date:** [16 March 2022 15:00 UTC](https://discourse.joplinapp.org/t/import-question/24427/5 "2022-03-16T15:00:53Z")

</div>

Yes, I thought about using Linux tooling and it'll probably work, but for me that would only be an interim solution; I would prefer some function in Joplin for this; and I'm probably the only person asking for such a feature so I'm not getting my hopes up 🙂

Thanks for your suggestion,  
kai.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/1/c/1c948e33314e232a0927789508474d8624f4270b.png) [@system](https://discourse.joplinapp.org/u/system)\
**Post date:** [15 April 2022 15:01 UTC](https://discourse.joplinapp.org/t/import-question/24427/6 "2022-04-15T15:01:51Z")

</div>

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