Import txt files

I realize you can rename files to .md and then import Markdown but it would be nice if you could just Import plain .txt files. Putting the path and file name in the Metadata would be an added bonus.

You may consider using the webclipper API to create notes through a python script. This gives you very powerful possibilities to work on the tile, content etc... Requires the web clipper feature to be enabled and joplin to be running :slight_smile:
Here is mine, adapted from GitHub - foxmask/jong: JOplin Notes Generator - project replaced by by @foxmask
It takes one argument - a filename with full path, like a PDF - and creates a note out of it in Joplin. The title of the note is the filename

Disclaimer : this is the first python I'm writing, please excuse the basicness of some constructs !

#!/usr/bin/env python
# coding: utf-8
    News generator for creating joplin notes

    The script use the webclipper service port - Enable the service from the menu "Tools > Webclipper option"

    python run

    Have Fun
# std lib
from __future__ import unicode_literals
import datetime
import time
#import asks
import requests
import sys
import os.path
from logging import getLogger
logger = getLogger('')


print("Adding {} to Joplin".format(fileName))

# Create the content of the note
content+="Nextcloud :{}\n".format(NCpath)
content+="Local : [{}](/{})\n".format(os.path.basename(fileName),fileName)
content+='\n\n# Bookmarks\n'
content+="Page  | Description\n"
content+="------ | ------------\n"
content+="x      | x\n"
content+="x      | x\n"

# Find the ID of the destination folder
res = requests.get("{}/folders".format(JOPLIN_WEBCLIPPER))
folders = res.json()

notebook_id = 0
for folder in folders:
    if folder.get('title') == JOPLIN_NOTEBOOK:
        notebook_id = folder.get('id')
if notebook_id == 0:
    for folder in folders:
        if 'children' in folder:
            for child in folder.get('children'):
                if child.get('title') == JOPLIN_NOTEBOOOK:
                    notebook_id = child.get('id')
data = {'title': os.path.basename(fileName).replace('.pdf','').replace('_',' '),
        'body': content,
        'parent_id': notebook_id,
        'author': sys.argv[0]}
res ="{}/notes".format(JOPLIN_WEBCLIPPER), json=data)
if res.status_code == 200:"fileName %s added" % (fileName))
    print("Added {} to Joplin".format(fileName))
    print("ERROR while adding {} to Joplin\n".format(fileName))

ha, nice! saw this just after I built my own python module.
Primary focus of mine is to handle notes with images…

cool, thanks ! will have a look at it.

I made some similar tools a short while ago.
One of my tools bypasses Joplin clients alltogether and manipulates the notes on the cloud server (local mirror of ownCloud/nextCloud).

I spent some time to polish them up and now they are on GitHub: . Feel free to play and feedback.