AI Course Scheduler from Completed Prereqs (Google Sheets + OpenAI)

Fortgeschritten

Dies ist ein Automatisierungsworkflow mit 13 Nodes. Hauptsächlich werden Set, SplitOut, GoogleSheets, ManualTrigger, Agent und andere Nodes verwendet.

Voraussetzungen
  • Google Sheets API-Anmeldedaten
  • OpenAI API Key

Kategorie

-
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "5432b2ed-adde-4021-b6b3-e75e43bd102c",
      "name": "Beim Klick auf „Workflow ausführen“",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1936,
        6608
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d25eca2c-90bb-4888-b474-8e433089ffb2",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1328,
        6880
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "4l6TDfLZVFS24g3X",
          "name": "OpenAi account 4"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "735096be-4698-4f16-9ba3-0f4e22d1b96e",
      "name": "Sticky Note66",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1408,
        6592
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 400,
        "content": "### 3) Connect OpenAI (API Key)\n1. In **n8n → Credentials → New → OpenAI API**  \n2. Paste your **OpenAI API key**  \n3. In **OpenAI Chat Model**, select your credential and a **vision-capable** chat model (e.g., `gpt-4o-mini`, `gpt-4o`, or your configured vision model)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "adc4b2bc-5927-409e-809f-bcaf9dd09ab5",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -1008,
        6592
      ],
      "parameters": {
        "jsonSchemaExample": "[\n  {\n    \"StudentID\": \"S001\",\n    \"Term\": \"Fall 2025\",\n    \"Selected\": [\n      \"CS-201 | Computer Systems | 3\",\n      \"CS-220 | Databases | 3\",\n      \"CS-210 | Web Development | 3\",\n      \"GEN-107 | Introduction to Sociology | 3\",\n      \"GEN-109 | Environmental Science | 4\"\n    ],\n    \"Rationale\": \"Student met prerequisites for sophomore-level Computer Science courses and added two Gen Eds for balance.\"\n  }\n]\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "6dc807d0-5f0d-4b88-8e37-3e05890b6f55",
      "name": "Sticky Note67",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1728,
        6160
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 656,
        "content": "### 1) Connect Google Sheets (OAuth2)\n1. In **n8n → Credentials → New → Google Sheets (OAuth2)**  \n2. Sign in with your Google account and grant access  \n3. In each Google Sheets node, select your **Spreadsheet** and the appropriate **Worksheet**:  \n   - **data** (raw spend)  \n   - **Lookup** (channel reference table)  \n   - **render pivot** (output tab)  \n\nhttps://docs.google.com/spreadsheets/d/10IMnD8JhiR4lTlNFQTG_Auopg8haAiEt3_G9EKWTqLw/edit?gid=572766543#gid=572766543\n"
      },
      "typeVersion": 1
    },
    {
      "id": "abb848f7-0819-423c-8e24-3541f469d5d0",
      "name": "Scheduling Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1168,
        6384
      ],
      "parameters": {
        "text": "=\n    \"StudentID\": \"{{$json.StudentID}}\",\n    \"Name\": \"{{$json.Name}}\",\n    \"Program\": \"{{$json.Program}}\",\n    \"Year\": \"{{$json.Year}}\",\n    \"CompletedCourses\": \"{{$json.CompletedCourses}}\"\n\n",
        "options": {
          "systemMessage": "You are a registrar scheduling assistant. Using ONLY the provided Students sheet (10 sophomores with pipe-separated CompletedCourses), generate exactly FIVE courses per student for the current term (Fall 2025) from the catalog below, following all constraints.\n\nCATALOG\n# Format: CourseID | Title | Credits | Program | Category | Prereqs(pipe-separated AND) | Offered(Fall/Spring/Both)\nGEN-101 | College Writing I | 3 | GenEd | Gen Ed |  | Both\nGEN-102 | College Writing II | 3 | GenEd | Gen Ed | GEN-101 | Both\nGEN-103 | Quantitative Reasoning | 3 | GenEd | Gen Ed |  | Both\nGEN-104 | Introduction to Philosophy | 3 | GenEd | Gen Ed |  | Both\nGEN-105 | Public Speaking | 3 | GenEd | Gen Ed |  | Both\nGEN-106 | World History Since 1500 | 3 | GenEd | Gen Ed |  | Both\nGEN-107 | Introduction to Sociology | 3 | GenEd | Gen Ed |  | Both\nGEN-108 | General Psychology | 3 | GenEd | Gen Ed |  | Both\nGEN-109 | Environmental Science | 4 | GenEd | Gen Ed (Lab) |  | Both\nGEN-110 | Introduction to Statistics | 3 | GenEd | Gen Ed | GEN-103 | Both\n\nCS-101 | Intro to Programming (Python) | 4 | Computer Science BS | Major Core |  | Both\nCS-102 | Data Structures | 4 | Computer Science BS | Major Core | CS-101 | Both\nCS-103 | Discrete Mathematics | 3 | Computer Science BS | Major Core | GEN-103 | Both\nCS-201 | Computer Systems | 3 | Computer Science BS | Major Core | CS-102 | Fall\nCS-202 | Algorithms | 4 | Computer Science BS | Major Core | CS-102|CS-103 | Spring\nCS-210 | Web Development | 3 | Computer Science BS | Major Elective | CS-101 | Both\nCS-220 | Databases | 3 | Computer Science BS | Major Core | CS-102 | Both\n\nDS-101 | Intro to Data Science | 3 | Data Science BS | Major Core | GEN-110|CS-101 | Both\nDS-201 | Linear Algebra for DS | 3 | Data Science BS | Major Core | GEN-103 | Both\nDS-202 | Probability & Statistics II | 3 | Data Science BS | Major Core | GEN-110 | Both\nDS-210 | Data Visualization | 3 | Data Science BS | Major Elective | DS-101 | Both\n\nBUS-101 | Principles of Management | 3 | Business Administration BBA | Major Core |  | Both\nBUS-102 | Microeconomics | 3 | Business Administration BBA | Major Core |  | Both\nBUS-103 | Macroeconomics | 3 | Business Administration BBA | Major Core |  | Both\nBUS-201 | Financial Accounting | 3 | Business Administration BBA | Major Core | GEN-110 | Both\nBUS-202 | Marketing Principles | 3 | Business Administration BBA | Major Core | BUS-101 | Both\nBUS-210 | Business Analytics with Excel | 3 | Business Administration BBA | Major Elective | GEN-110 | Both\n\nPSY-101 | Introduction to Psychology | 3 | Psychology BA | Major Core |  | Both\nPSY-201 | Research Methods in Psychology | 3 | Psychology BA | Major Core | GEN-110|PSY-101 | Both\nPSY-210 | Cognitive Psychology | 3 | Psychology BA | Major Elective | PSY-101 | Fall\n\nBIO-101 | General Biology I (Lab) | 4 | Biology BS (Pre-Med) | Major Core |  | Fall\nBIO-102 | General Biology II (Lab) | 4 | Biology BS (Pre-Med) | Major Core | BIO-101 | Spring\nCHM-101 | General Chemistry I (Lab) | 4 | Biology BS (Pre-Med) | Major Core |  | Fall\nCHM-102 | General Chemistry II (Lab) | 4 | Biology BS (Pre-Med) | Major Core | CHM-101 | Spring\nBIO-201 | Genetics | 3 | Biology BS (Pre-Med) | Major Core | BIO-102|GEN-110 | Fall\nBIO-210 | Cell Biology | 3 | Biology BS (Pre-Med) | Major Elective | BIO-102 | Spring\n\nENGR-101 | Intro to Engineering | 3 | Mechanical Engineering BS | Major Core |  | Both\nENGR-102 | Engineering Graphics | 3 | Mechanical Engineering BS | Major Core |  | Both\nMTH-121 | Calculus I | 4 | Mechanical Engineering BS | Major Core | GEN-103 | Both\nMTH-122 | Calculus II | 4 | Mechanical Engineering BS | Major Core | MTH-121 | Both\nPHY-151 | Physics I (Calc-Based, Lab) | 4 | Mechanical Engineering BS | Major Core | MTH-121 | Fall\nPHY-152 | Physics II (Calc-Based, Lab) | 4 | Mechanical Engineering BS | Major Core | PHY-151|MTH-122 | Spring\nME-201 | Statics | 3 | Mechanical Engineering BS | Major Core | PHY-151|MTH-122 | Fall\nME-210 | Materials Science | 3 | Mechanical Engineering BS | Major Elective | CHM-101 | Spring\n\nNUR-101 | Foundations of Nursing | 4 | Nursing BSN | Major Core |  | Fall\nNUR-102 | Health Assessment | 3 | Nursing BSN | Major Core | NUR-101 | Spring\nNUR-201 | Pathophysiology | 3 | Nursing BSN | Major Core | CHM-101|BIO-101 | Fall\nNUR-210 | Pharmacology | 3 | Nursing BSN | Major Core | NUR-201 | Spring\n\nENG-101 | Intro to Literary Studies | 3 | English Literature BA | Major Core | GEN-101 | Both\nENG-201 | British Literature I | 3 | English Literature BA | Major Core | ENG-101 | Fall\nENG-210 | Creative Writing Workshop | 3 | English Literature BA | Major Elective | ENG-101 | Both\n\nECON-101 | Principles of Microeconomics | 3 | Economics BA | Major Core |  | Both\nECON-102 | Principles of Macroeconomics | 3 | Economics BA | Major Core |  | Both\nECON-201 | Intermediate Microeconomics | 3 | Economics BA | Major Core | ECON-101|GEN-110 | Fall\nECON-202 | Intermediate Macroeconomics | 3 | Economics BA | Major Core | ECON-102|GEN-110 | Spring\n\nART-101 | Design Foundations | 3 | Graphic Design BFA | Major Core |  | Both\nART-102 | Drawing I | 3 | Graphic Design BFA | Major Core |  | Both\nART-201 | Typography | 3 | Graphic Design BFA | Major Core | ART-101 | Fall\nART-210 | Digital Imaging | 3 | Graphic Design BFA | Major Elective | ART-101 | Both\n\nCONSTRAINTS\n1) Exactly 5 courses per student; target total 15–17 credits.\n2) Enforce prerequisites: all listed prereqs must already be in CompletedCourses.\n3) Use only courses offered in Fall or Both for Fall 2025.\n4) Prioritize Major Core, then Major Elective, then Gen Ed. Include at least one Gen Ed if still needed.\n5) No duplicates or courses already completed.\n6) Prefer 200-level progression where available and allowed by prereqs.\n\nINPUT\n- Students: an array of records from the Google Sheet with fields:\n  StudentID, Name, Program, Year, CompletedCourses (pipe-separated CourseIDs)\n\nOUTPUT\nReturn a JSON array; one object per student:\n[\n  {\n    \"StudentID\": \"S001\",\n    \"Term\": \"Fall 2025\",\n    \"Selected\": [\n      \"CS-201 | Computer Systems | 3\",\n      \"CS-220 | Databases | 3\",\n      \"CS-210 | Web Development | 3\",\n      \"GEN-107 | Introduction to Sociology | 3\",\n      \"GEN-109 | Environmental Science | 4\"\n    ],\n    \"Rationale\": \"Student met prerequisites for sophomore-level Computer Science courses and added two Gen Eds for balance.\"\n  }\n]\n\n\nIMPLEMENTATION NOTES\n- Parse CompletedCourses by splitting on \"|\".\n- Treat Prereqs as AND (e.g., \"CS-102|CS-103\" requires both).\n- \"GenEd\" courses apply to any program.\n- If a student cannot reach 5 major-appropriate courses, fill remaining slots with Gen Eds without prerequisites that are offered in Fall/Both to stay within 15–17 credits.\n",
          "passthroughBinaryImages": true
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "executeOnce": false,
      "typeVersion": 2.2
    },
    {
      "id": "7e482cae-9c94-4b19-a828-e067fa7cbb1b",
      "name": "Felder setzen",
      "type": "n8n-nodes-base.set",
      "position": [
        -544,
        6384
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f239fdfb-f2ed-4e30-bb81-560cb624cdb9",
              "name": "StudentID",
              "type": "string",
              "value": "={{ $json.output[0].StudentID }}"
            },
            {
              "id": "249bdf9e-6f9b-4e45-a5c9-288128c03e51",
              "name": "Schedule",
              "type": "string",
              "value": "={{ $json['output[0].Selected'] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "de5141a8-d7d2-4392-b516-d3b48f565e5e",
      "name": "sheet1 löschen",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -336,
        6384
      ],
      "parameters": {
        "operation": "clear",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 572766543,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10IMnD8JhiR4lTlNFQTG_Auopg8haAiEt3_G9EKWTqLw/edit#gid=572766543",
          "cachedResultName": "schedule"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "10IMnD8JhiR4lTlNFQTG_Auopg8haAiEt3_G9EKWTqLw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10IMnD8JhiR4lTlNFQTG_Auopg8haAiEt3_G9EKWTqLw/edit?usp=drivesdk",
          "cachedResultName": "Student Details"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "9ae9d8a6-680b-4df0-b41f-95aa314f0679",
      "name": "Sticky Note56",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2016,
        6016
      ],
      "parameters": {
        "color": 7,
        "width": 2144,
        "height": 1056,
        "content": "### 🎓 AI Course Scheduler from Completed Prereqs (Google Sheets + OpenAI)\n\nCreate a **Fall 2025 course schedule** for each student based on what they’ve already completed, catalog prerequisites, and term availability (Fall/Both). Reads students from Google Sheets → asks an AI agent to select **exactly 5 courses** (target **15–17 credits**, no duplicates, prereqs enforced) → appends each student’s schedule to a **schedule** tab.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b55540c2-7e9d-4998-9c87-fa8ef37ff943",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2448,
        6016
      ],
      "parameters": {
        "width": 400,
        "height": 1056,
        "content": "### ⚙️ Setup (only 2 steps)\n\n#### 1) Connect Google Sheets (OAuth2)\n- In **n8n → Credentials → New → Google Sheets (OAuth2)**, sign in and grant access  \n- In the Google Sheets nodes, select your spreadsheet and these tabs:\n  - **Sheet1** (input students)\n  - **schedule** (output)\n\n> Example spreadsheet (replace with your own):  \n> - Input: `.../edit#gid=0`  \n> - Output: `.../edit#gid=572766543`\n\n#### 2) Connect OpenAI (API Key)\n- In **n8n → Credentials → New → OpenAI API**, paste your key  \n- In the **OpenAI Chat Model** node, select that credential and a chat model (e.g., `gpt-4o`)\n\n\n\n- 📧 **rbreen@ynteractive.com**  \n- 🔗 **Robert Breen** — https://www.linkedin.com/in/robert-breen-29429625/  \n- 🌐 **ynteractive.com** — https://ynteractive.com\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b23e80f6-a848-4fdc-989d-f500fae50f8d",
      "name": "Studentendaten abrufen",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1664,
        6672
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10IMnD8JhiR4lTlNFQTG_Auopg8haAiEt3_G9EKWTqLw/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "10IMnD8JhiR4lTlNFQTG_Auopg8haAiEt3_G9EKWTqLw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10IMnD8JhiR4lTlNFQTG_Auopg8haAiEt3_G9EKWTqLw/edit?usp=drivesdk",
          "cachedResultName": "Student Details"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e8c4be35-a682-43af-806c-4a0908fad56f",
      "name": "Stundenplan aufteilen",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -800,
        6384
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "output[0].Selected"
      },
      "typeVersion": 1
    },
    {
      "id": "40109987-d4b5-48d5-aea6-1923956ad3e8",
      "name": "Stundenplan anfügen",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -128,
        6384
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "StudentID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "StudentID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Schedule",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Schedule",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 572766543,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10IMnD8JhiR4lTlNFQTG_Auopg8haAiEt3_G9EKWTqLw/edit#gid=572766543",
          "cachedResultName": "schedule"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "10IMnD8JhiR4lTlNFQTG_Auopg8haAiEt3_G9EKWTqLw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10IMnD8JhiR4lTlNFQTG_Auopg8haAiEt3_G9EKWTqLw/edit?usp=drivesdk",
          "cachedResultName": "Student Details"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    }
  ],
  "pinData": {},
  "connections": {
    "7e482cae-9c94-4b19-a828-e067fa7cbb1b": {
      "main": [
        [
          {
            "node": "de5141a8-d7d2-4392-b516-d3b48f565e5e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "de5141a8-d7d2-4392-b516-d3b48f565e5e": {
      "main": [
        [
          {
            "node": "40109987-d4b5-48d5-aea6-1923956ad3e8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e8c4be35-a682-43af-806c-4a0908fad56f": {
      "main": [
        [
          {
            "node": "7e482cae-9c94-4b19-a828-e067fa7cbb1b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b23e80f6-a848-4fdc-989d-f500fae50f8d": {
      "main": [
        [
          {
            "node": "abb848f7-0819-423c-8e24-3541f469d5d0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "abb848f7-0819-423c-8e24-3541f469d5d0": {
      "main": [
        [
          {
            "node": "e8c4be35-a682-43af-806c-4a0908fad56f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d25eca2c-90bb-4888-b474-8e433089ffb2": {
      "ai_languageModel": [
        [
          {
            "node": "abb848f7-0819-423c-8e24-3541f469d5d0",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "adc4b2bc-5927-409e-809f-bcaf9dd09ab5": {
      "ai_outputParser": [
        [
          {
            "node": "abb848f7-0819-423c-8e24-3541f469d5d0",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "5432b2ed-adde-4021-b6b3-e75e43bd102c": {
      "main": [
        [
          {
            "node": "b23e80f6-a848-4fdc-989d-f500fae50f8d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Fortgeschritten

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Fortgeschritten
Anzahl der Nodes13
Kategorie-
Node-Typen8
Schwierigkeitsbeschreibung

Für erfahrene Benutzer, mittelkomplexe Workflows mit 6-15 Nodes

Autor
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34