# Timetable PDF to Calendar (ICS) with AI (`mkonedev/timetable-to-calendar`) Actor

Turn any university or college timetable PDF into a Google/Outlook/Apple calendar file (.ics) and clean JSON. Repeats weekly for the semester, skips non-teaching weeks, filters to your own modules.

- **URL**: https://apify.com/mkonedev/timetable-to-calendar.md
- **Developed by:** [MK One](https://apify.com/mkonedev) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 88.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Timetable PDF to Calendar (ICS) with AI

Turn any university or college **timetable PDF** into a **calendar file (.ics)** for
Google Calendar, Outlook or Apple Calendar, plus clean JSON, in one run.

- Works with grids, lists and multi-page timetables (read by Google Gemini AI)
- Every class **repeats weekly** from semester start to end
- **Skips non-teaching weeks** when the timetable lists them (e.g. "Weeks 1-6, 8-14")
- **Respects each class's own dates**: a Semester 2 class listed on the same PDF stays out of your Semester 1 calendar
- **Only your modules**: give your module codes and get just your classes
- Correct **time zones** (any IANA zone; fixed-offset zones like South Africa get a full VTIMEZONE)

### Input

| Field | Example | Notes |
|---|---|---|
| `pdfUrl` | `https://uni.ac.za/timetables/bsc1.pdf` | Public link to the PDF (max 20 MB) |
| `semesterStart` | `2027-02-01` | Week 1 = the week containing this date |
| `semesterEnd` | `2027-05-28` | Last day classes repeat |
| `modules` | `["CSC1101", "MAT 1101"]` | Optional. Spaces/capitals ignored, prefixes match |
| `timezone` | `Africa/Johannesburg` | Default Africa/Johannesburg |
| `calendarName` | `My semester 1` | Optional |
| `model` | `gemini-4-hydrogen` | Or `gemini-3.5-flash-lite` for simple timetables |

### Output

- **Dataset**: one row per weekly class (day, start, end, module, title, type, venue, lecturer, weeks, first and last class date)
- **Key-value store**: `timetable.ics` (import into any calendar), `timetable.json` (everything the AI read), `OUTPUT` (summary + direct calendar link)

### Pricing

Pay per result: you are charged **once per timetable successfully converted** (event `timetable-converted`).
No charge when the input is invalid, the PDF can't be read, or no classes match your modules.

### Privacy

The PDF is sent to Google's Gemini API to be read and is not kept for later use by this Actor.
Depending on the Actor's Google plan, Google may use what is sent to improve its products, so only
link **public timetables**, never documents with personal information. Results stay in your own Apify storage.

### Limits

AI reading is very good but not perfect. Check the first week in your calendar against the PDF.
Scanned (image-only) PDFs work less well than text PDFs. If a class has no readable day or time it is
skipped and the run log says how many were skipped.

***

Developers: `npm test` (36 tests), `npm run build`, publishing steps in [docs/PUBLISH.md](docs/PUBLISH.md).

# Actor input Schema

## `pdfUrl` (type: `string`):

A public link to the timetable PDF (from your university website or a shared file). The example is a real public timetable from Wits University.

## `semesterStart` (type: `string`):

First day of teaching, yyyy-mm-dd. Week 1 is the week containing this date.

## `semesterEnd` (type: `string`):

Last day of teaching, yyyy-mm-dd. Classes repeat weekly until this date.

## `modules` (type: `array`):

Module/course codes to keep, e.g. CSC1101. Spaces and capitals don't matter. Leave empty for the whole timetable.

## `timezone` (type: `string`):

IANA time zone of the university, e.g. Africa/Johannesburg, Europe/London, America/New_York.

## `calendarName` (type: `string`):

Name shown in the calendar app. Defaults to the timetable's heading.

## `model` (type: `string`):

Gemini 4 Hydrogen reads complex grids best; Flash-Lite is quicker for simple, clean timetables.

## Actor input object example

```json
{
  "pdfUrl": "https://www.wits.ac.za/media/wits-university/faculties-and-schools/-engineering-and-the-built-environment/mechanical-industrial-aeronautical-engineering/documents/postgraduate-documents/2026/PG-Dip%20Timetable%202026%20V1.pdf",
  "semesterStart": "2026-02-03",
  "semesterEnd": "2026-05-19",
  "timezone": "Africa/Johannesburg",
  "model": "gemini-4-hydrogen"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "pdfUrl": "https://www.wits.ac.za/media/wits-university/faculties-and-schools/-engineering-and-the-built-environment/mechanical-industrial-aeronautical-engineering/documents/postgraduate-documents/2026/PG-Dip%20Timetable%202026%20V1.pdf",
    "semesterStart": "2026-02-03",
    "semesterEnd": "2026-05-19"
};

// Run the Actor and wait for it to finish
const run = await client.actor("mkonedev/timetable-to-calendar").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "pdfUrl": "https://www.wits.ac.za/media/wits-university/faculties-and-schools/-engineering-and-the-built-environment/mechanical-industrial-aeronautical-engineering/documents/postgraduate-documents/2026/PG-Dip%20Timetable%202026%20V1.pdf",
    "semesterStart": "2026-02-03",
    "semesterEnd": "2026-05-19",
}

# Run the Actor and wait for it to finish
run = client.actor("mkonedev/timetable-to-calendar").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "pdfUrl": "https://www.wits.ac.za/media/wits-university/faculties-and-schools/-engineering-and-the-built-environment/mechanical-industrial-aeronautical-engineering/documents/postgraduate-documents/2026/PG-Dip%20Timetable%202026%20V1.pdf",
  "semesterStart": "2026-02-03",
  "semesterEnd": "2026-05-19"
}' |
apify call mkonedev/timetable-to-calendar --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mkonedev/timetable-to-calendar"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/5CWtmbmrVDyVr3Ru8/builds/Hke2nuAomoJh0gHQC/openapi.json
