1. Opening Problem Statement
Meet Jim, a university student at Westminster who struggles every semester to manually input all the term dates and key academic events into his calendar. Jim spends hours each term downloading spreadsheets, deciphering rows of complicated data, and entering event after event into Google Calendar – a tedious process prone to errors and missed deadlines. This manual approach wastes time, risks missing important dates, and creates stress when planning studies and assignments around fixed university terms.
This is the exact scenario our n8n workflow solves. By automating the extraction and conversion of term dates from the official Westminster university Excel document into a sharable ICS calendar file, it drastically reduces manual data entry and errors for students, lecturers, and administrative staff alike.
2. What This Automation Does
This unique n8n automation does the following whenever the workflow is triggered:
- 1. Downloads the official Westminster university term dates Excel file directly from their website using the HTTP Request node.
- 2. Uses Cloudflare’s Markdown Conversion Service to transform the Excel spreadsheet into a machine-readable markdown table, enabling AI processing.
- 3. Applies Google Gemini’s AI-powered Language Model to extract structured event data such as week numbers, start dates, and event titles from the markdown.
- 4. Post-processes dates and sorts extracted events logically by their start dates.
- 5. Converts the event data into a standard ICS calendar format via a Python Code node, making the events easily importable into Google Calendar, Outlook, or iCal.
- 6. Generates a binary ICS file from the calendar data and automatically emails it as an attachment through Gmail, sharing it with relevant recipients.
Benefits include saving several hours per semester, eliminating manual entry errors, and instantly sharing updated academic calendars with entire student groups or faculties.
3. Prerequisites ⚙️
- n8n account with access to the nodes used: HTTP Request, Code, Gmail.
- Cloudflare account to use the Markdown Conversion Service (for Excel to markdown conversion). 🔐
- Google Gemini API credentials for AI document understanding and data extraction. 🔐
- Gmail OAuth2 credentials to send emails with ICS attachments. 📧
- Basic familiarity with importing ICS files into calendar apps like Google Calendar, Outlook, or iCal.
- (Optional) Self-hosting for n8n available if desired for privacy or control—see sites like https://buldrr.com/hostinger.
4. Step-by-Step Guide
Step 1: Trigger the workflow manually
Navigate to your workflow in n8n and click the “Test workflow” button. This will start the automation from the beginning, simulating a real usage scenario.
You should see the manual trigger node activate and pass control to the next node.
Common Mistake: Forgetting to click “Test workflow” or activating the manual trigger node will prevent the workflow from running.
Step 2: Download the university term dates Excel file
Located after the manual trigger, the HTTP Request node named “Get Term Dates Excel” is configured to fetch the file from
“https://www.westminster.ac.uk/sites/default/public-files/general-documents/undergraduate-term-dates-2025%E2%80%932026.xlsx”.
After execution, the node saves the file content in binary format to pass it on.
Common Mistake: Changing the URL incorrectly or network issues will cause download failures.
Step 3: Convert Excel to markdown with Cloudflare API
The “Markdown Conversion Service” HTTP Request node posts the downloaded Excel binary data to Cloudflare’s API, converting the spreadsheet sheets to markdown tables for AI parsing.
Make sure to update the URL with your Cloudflare ACCOUNT_ID in the format:
https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/tomarkdown as indicated in the sticky note.
Visual cue: The response is markdown text representing the sheets.
Common Mistake: Missing or incorrect Cloudflare credentials will cause authorization failures.
Step 4: Extract the specific target sheet from markdown
The “Extract Target Sheet” Set node pulls out the exact markdown representation of the desired sheet from the response, making it ready for AI extraction.
This isolates the relevant table data before sending it to the AI node.
Step 5: Extract event data using AI Information Extractor
The “Extract Key Events and Dates” node uses n8n’s Langchain Information Extractor powered by Google Gemini to parse the markdown and produce structured JSON with properties: week_number, week_beginning as raw date string, and title.
The system prompt is configured not to convert dates to maintain Excel-style numbering for post-processing.
Data example:
[
{ "week_number": 37, "week_beginning": "45922", "title": "Semester 1 start" },
{ "week_number": 38, "week_beginning": "45929", "title": "Induction week" }
]Common Mistake: Incorrect extraction schema leads to empty or malformed JSON data.
Step 6: Split the events to individual items for processing
The “Events to Items” SplitOut node breaks the array of events into separate workflow items to handle each event separately in subsequent nodes.
Step 7: Fix dates to proper ISO format
The “Fix Dates” Set node converts the Excel serial date numbers into correct ISO date strings. It does this by adjusting the date from an Excel epoch and adjusting to UTC format.
Example formula inside the node:
new Date(2025,8,15,0,0,0).toDateTime().toUTC()
.plus({ 'day': $json.week_beginning - 45915 })Common Mistake: Wrong epoch or date offset will produce inaccurate dates.
Step 8: Sort events by date for correct order
The “Sort Events by Date” node sorts the event items by their week_beginning date to ensure calendar entries appear in chronological order.
Step 9: Convert events to ICS calendar format using Python Code node
The “Events to ICS Document” Python Code node uses custom Python code to format events into an ICS calendar string compliant with iCalendar specifications.
Highlights from the code:
from datetime import datetime, timedelta
import base64
for event_data in json_array:
week_beginning = datetime.fromisoformat(week_beginning_str.replace('Z', '+00:00'))
week_ending = week_beginning + timedelta(days=7)
ical.extend([
"BEGIN:VEVENT",
f"SUMMARY:{title}",
...
])
ical.append("END:VCALENDAR")
return "rn".join(ical)The final ICS content is base64 encoded for passing along in workflow.
Common Mistake: Ensure consistent date formatting, especially time zones and ISO strings.
Step 10: Convert ICS text to binary file for email attachment
The “Create ICS File” ConvertToFile node takes the encoded ICS text and packages it as a binary file named from the original Excel filename with a .ics extension.
You can now send this binary as an email attachment or upload it elsewhere.
Step 11: Email the ICS calendar attachment
Finally, the Gmail node “Send Email with Attachment” sends the ICS file to the configured recipient, in this example, [email protected], with a subject and body message.
Ensure your Gmail OAuth2 credentials are configured properly to send emails via n8n.
5. Customizations ✏️
- Change the Excel URL: In the “Get Term Dates Excel” HTTP Request node, replace the URL parameter to point to another university or department schedule Excel file.
- Adjust AI extraction schema: Modify the “Extract Key Events and Dates” node’s input schema to include additional fields like “description” or “location” if your Excel contains extra information.
- Send ICS via other channels: Instead of Gmail, route the ICS file to Google Drive or a file server by adding appropriate nodes for storage or messaging.
- Use different AI models: Switch out the Google Gemini Chat Model node to another language model supported by n8n for document processing.
- Expand Date Fix logic: Enhance the “Fix Dates” node to handle multiple date formats or timezones based on input data variety.
6. Troubleshooting 🔧
- Problem: “Failed to fetch Excel file” in HTTP Request node.
Cause: Incorrect URL or network issues.
Solution: Verify the URL is correct and the server is reachable. Test URL in a browser first. - Problem: “Authentication error” in Cloudflare Markdown Conversion Service.
Cause: Missing or invalid Cloudflare API credentials.
Solution: Confirm the API key and account ID are correct under credential settings in the node. - Problem: “Empty or malformed JSON” from Extract Key Events and Dates node.
Cause: Incorrect AI prompt or schema not aligned with markdown format.
Solution: Adjust the system prompt or inspect the markdown data being passed to the node for correctness. - Problem: “Email sending failed” in Gmail node.
Cause: OAuth token expired or permissions insufficient.
Solution: Re-authenticate Gmail OAuth2 credentials in n8n and ensure proper API scopes enabled.
7. Pre-Production Checklist ✅
- Confirm the ability to manually trigger the workflow successfully.
- Test HTTP Request node downloads Excel file correctly.
- Validate Cloudflare account credentials and API access.
- Verify the AI Information Extractor node returns structured event data in correct schema.
- Run workflow fully to generate ICS file and verify file opens/imports correctly in calendar applications.
- Check Gmail OAuth2 credentials and test sending sample emails with attachment.
- Backup your workflow configuration before major changes.
8. Deployment Guide
Once satisfied with your testing, activate the workflow in n8n to run on demand or schedule as needed. Monitor the workflow execution logs within n8n to catch any errors or data inconsistencies over time.
This workflow is lightweight, relying mainly on a manual trigger but could be easily extended with scheduling nodes or webhook triggers for automated periodic updates.
Regularly update your API credentials (Cloudflare, Google Gemini, Gmail) and verify URL endpoints remain valid to ensure continued operation.
9. FAQs
- Q: Can I use a different AI model instead of Google Gemini?
A: Yes, n8n supports several AI integrations. Just replace the Google Gemini Chat Model node with another supported LLM node according to your preferences. - Q: Does this workflow consume a lot of API credits?
A: Usage depends on your Cloudflare plan for Markdown Conversion and Google Gemini API calls. Monitor usage to avoid unexpected costs. - Q: Is my data secure?
A: Data is transmitted to trusted services (Cloudflare, Google Gemini) with encrypted HTTPS. Ensure you handle credentials securely within n8n. - Q: Can this handle multiple universities or terms?
A: Yes, by adjusting the Excel URL and extraction patterns, you can adapt this workflow for multiple institutions or academic calendars.
10. Conclusion
You’ve just built a powerful n8n automation that downloads a university’s term dates Excel file, uses AI to extract key events, formats them into an ICS calendar, and shares it via email. This dramatically reduces manual entry effort and ensures up-to-date academic scheduling for all recipients.
By saving hours each semester and reducing errors, you empower students like Jim to focus more on learning and less on admin. Next steps could include integrating with student portals, adding SMS reminders, or syncing with team collaboration tools to further enhance academic planning workflows.
Keep experimenting, refining, and automating your repetitive tasks to create more time for what truly matters.