Created
October 9, 2023 17:27
-
-
Save dkolb/b0ce78c2028ba2be359d31661467d89a to your computer and use it in GitHub Desktop.
Reading in reminders from a CSV file and then adding them to Apple Reminders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {runJxa} from 'run-jxa' | |
import { parse } from 'csv-parse' | |
import { readFile } from 'node:fs/promises' | |
const fileContents = await readFile('/Users/david/Downloads/Cinema_2023-10-09_11-53-49.csv', {encoding: 'UTF-8'}) | |
parse(fileContents, { | |
columns: true | |
}, async function(err, records){ | |
for ( const toDoItem of records) { | |
console.log(toDoItem) | |
await runJxa((title, status) => { | |
reminders = Application('Reminders'); | |
const newReminder = reminders.Reminder({ | |
name: `${title}`, | |
completed: `${status}` === 'completed' | |
}); | |
reminders.lists.byName('Cinema').reminders.push(newReminder); | |
}, [ toDoItem.title, toDoItem.status ]) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment