Import tasks


Import tasks


Converts all lines of a note into tasks, applying the identified date on a line as a Start Date for that task.


Use this plugin if you want to quickly generate tasks with Start Dates. Given a note, convert each line of the note into a task and apply any dates found in the text of the task. The date format that is expected is: MM/DD/YYYY. Can be extended to support multiple date formats.

Before -> After



noteOption(app, noteUUID) {
(async function() {
const note = await app.notes.find(noteUUID);
const content = await note.content();
const lines = content.split("\n");
for (const line of lines) {
if (!line.trim()) continue; // ignore empty lines
const dateRegex = /(\d{1,2}\/\d{1,2}\/\d{4}|\d{4}-\d{1,2}-\d{1,2})(\s+\d{1,2}:\d{1,2})?/;
const match = line.match(dateRegex);
let startAt = null;
if (match) {
const dateTimeString = match[0];
const timestamp = new Date(dateTimeString).getTime();
if (!isNaN(timestamp)) {
startAt = Math.floor(timestamp / 1000);
const task = { content: line, startAt };
await note.insertTask(task);