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).
you could do that by leveraging joplins data API. A python script could look like:
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.
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.
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
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