Great episode lots learned and loads of workflow ideas to play with
Using all @Sal 's advice (thanks ) here is the (hopefully) final script to bulk import events into stock MacOS Calendar app. Since all popular calendar apps use the same database, it works also with Fantastical etc.with the additional flexibility for those who use just the stock app.
You can also specify multiple alarms, as requested above by @leo. I included support for only two in my script, but if you need more, just add column(s) in the Numbers sheet and adapt the script by adding additional line(s) for third etc. alarm(s).
Bulk import of events into Calendar
tell application "Numbers"
activate
try
if not (exists document 1) then error number 1000
tell document 1
try
tell active sheet
set the selectedTable to ¬
(the first table whose class of selection range is range)
end tell
on error
error number 1001
end try
tell selectedTable
set theseRows to the rows of selection range
repeat with i from 1 to the count of theseRows
copy the value of every cell of item i of theseRows to ¬
{eventName, eventLocation, startDate, eventDuration, endDate, eventNotes, eventAlarm1, eventAlarm2, calendarName}
tell application "Calendar"
tell calendar calendarName
set newEvent to make new event with properties ¬
{summary:eventName, start date:startDate, end date:endDate, location:eventLocation, description:eventNotes}
tell newEvent
make new display alarm at end with properties {trigger interval:-eventAlarm1}
make new display alarm at end with properties {trigger interval:-eventAlarm2}
end tell
end tell
end tell
end repeat
end tell
end tell
on error errorMessage number errorNumber
if errorNumber is 1000 then
set alertString to "MISSING RESOURCE"
set errorMessage to "Please create or open a document before running this script."
else if errorNumber is 1001 then
set alertString to "SELECTION ERROR"
set errorMessage to "Please select a table before running this script."
else
set alertString to "EXECUTION ERROR"
end if
display alert alertString message errorMessage buttons {"Cancel"}
error number -128
end try
end tell
To Use:
Copy the Numbers sheet to your Mac.
Enter/copy events (duration and alarms have to be entered in minutes).
Specify the name of the calendar you want to import into.
Select the rows you want to import.
Run the script.
Check to see if it support normal importing. Should work with csv-files.
We’ve been looking at those, and of course IFTTT will work on Android (and is actually more powerful on the non iCloud calendar options), we do have a section of this forum for Android though, and I hope we can find out more about the tools that you can use on Android for things like this!
Great episode! Wondering if the fantastical numbers sheet will be shared?
It’s in the blog post!
Thanks! didn’t catch there was a blog!
Question:
I have a mostly fixed schedule, but with varying start times. I’d like to be able to make a schedule for any day based on a start time and have it schedule everything out from that start time.
Ex.
Start time: Varying
Block 1: +30m from start time
Block 2: +1h
Block 3: +2h
Block 4: +2h
etc.
etc.
So far what I’ve done is modify Davids workflow for his time blocking and just insert the start and end dates manually, but it gets pretty tedious.
I’d like to be able to do it manually. I haven’t been able to figure out a way using workflow. Is there a way to do it?
Have a look at this as an example:
https://workflow.is/workflows/24b35731dd8942c39bbc4001d9bbe4a3
Essentially you’re going to need a fair few “adjust date” actions - and make sure the date magic variables are set to time only
New Workflow - Things to Calendar
OK… so this episode inspired me to go fix a problem I was having. On the Mac, I like to plan my day with dragging Things tasks over to my calendar to block time for work. On iOS, that is not possible. Since I am now doing my planning on the train going in to work, I needed a solution.
What I did was create a Workflow share extension that takes a task from Things, and adds it to my calendar. When I share the task, it asks me when I want to start it, and defaults to a 30 min block of time. I have a chance to change that prior to saving it. It is basic, but it works.
I wish I could grab the task link, or separate the title from the Notes… but for now, this solved my problem. Sharing with all of you lovely people.
https://workflow.is/workflows/df661881e1a74faa8ab56af0401fc3c5
Is there a way to make events “all-day”? I schedule the events each year for my department, and many of the events are all-day, several days, or even all-week long. Is there a way to add a column or a variable or a checkbox (something!) to the Numbers table so that it enters those events correctly?
Currently, I’ve been doing this the other way: make all the events in the calendar, and then export it as a .ics, then using Free ICS to CSV Converter convert it to CSV document, which I can then convert into a spreadsheet. Most (all?) of my colleagues are on Macs/iPhones and so being able to import a calendar into their system is ideal. But some colleagues really like to see the events as a table, just like the Numbers spreadsheet.
From memory if you skip the duration it should default to an all date event.
Yes, there is, through a Boolean variable. I was thinking about adding it to the table and then I decided to wait until someone asks for it . Or maybe it can be cheated by skipping duration as @RosemaryOrchard suggested. Will look into it.
Thank you so much for this first episode, screencasts and for sharing your workflows! The “Parsing a list of events with Numbers” will save me lots of time when adding all of my teaching classes to Fantastical. Already tried and works perfectly. Brilliant! Thank you.
I’m glad you have a use for it!
Thank you Jiri, @jplacek . As I try to run this, I get the same error over and over; clearly I don’t understand what I’m doing wrong. “Calendar got an error: Can’t make missing value into type text.”
Any thoughts on what I’m doing wrong?
Hello Eric, I tested your sheet and it seems the problem is that the field for URL/Notes cannot be empty. So if you don’t have anything specific to put there, just leave e.g. “note” in there. It`s not very elegant solution but the fastest right now. Also I would format the alert columns as Number, although that was not the primary cause of the error you were getting. Hope this helps
Love the show and this episode. My question. It seems that a lot of your bulk event scheduling was done on Mac? Is this possible on iPad? in iOS. I want to begin automating more of my calendar entries but can’t quite afford a 50 dollar calendar app on the Mac.