Skip to content

Instantly share code, notes, and snippets.

@dkolb
Created October 9, 2023 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkolb/b0ce78c2028ba2be359d31661467d89a to your computer and use it in GitHub Desktop.
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
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