AI-Powered Student Answer Sheet Grading with Gemini and Google Sheets - n8n Workflow

Automate grading student answer sheets using this n8n workflow. Leverage the Gemini AI n8n node for image analysis and comparative evaluation, logging detailed results into Google Sheets.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Educators and Teachers: Seeking to drastically reduce the time spent on manual grading.
School Administrators: Interested in deploying scalable, consistent evaluation systems.
Automation Enthusiasts: Looking for advanced n8n templates integrating image recognition, LLMs, and Google Workspace.
Developers: Needing an example of a complex, multi-tool AI Agent implemented using n8n.

Overview

Manual grading of answer sheets is a laborious and repetitive task. This specific n8n workflow solves this by establishing a sophisticated AI evaluation agent. The system is initiated via a simple form n8n trigger where an examiner uploads a scanned answer sheet. The workflow uses the Google Gemini n8n node to first analyze the image, extracting the student’s handwriting and answers.

Crucially, the core AI Agent is given access to reference materials (Question Paper and Correct Answer Sheet via Google Docs n8n node tools). It compares the extracted student answers against the correct answers, calculates the marks, and generates a structured JSON output. This robust n8n workflow then pushes both a summary and a detailed, question-by-question scorecard into Google Sheets, making the evaluation process seamless, fast, and accurate. Utilizing this powerful n8n workflow saves significant staff time.

How it Works

This automation initiates with an n8n trigger and proceeds through three primary phases: ingestion, evaluation, and reporting.


  1. Ingestion (Form Trigger): The process starts with the 'Answer Sheet Uploader' n8n trigger, which is an n8n Form Trigger. An examiner submits their name and uploads the student's scanned answer sheet (PNG/JPG).

  2. Image Analysis (Gemini Node): The uploaded image is passed to the 'Analyze an image' Google Gemini n8n node. This specialized n8n node uses vision capabilities to accurately transcribe the student's handwritten answers and identity details from the image.

  3. AI Evaluation (Agent Node): The core 'AI Agent' n8n node is executed. It receives the transcription from the previous step as user input. It utilizes three critical components: a Language Model ('Google Gemini Chat Model'), the 'Question Paper 5Th Class' reference (n8n node acting as a tool), and the 'Answer Paper 5th Class' reference (n8n node acting as a tool). The agent follows detailed instructions to compare the answers and calculate scores, enforcing a strict JSON output structure using the 'Structured Output Parser1' n8n node.

  4. Reporting (Google Sheets): The evaluated data is split into two reporting streams:

Summary: The 'Append Summary' n8n node takes the overall score (Total Marks, Correct/Incorrect count, Marks Obtained) and logs it into a summary sheet.
Detail: The 'Code to merge multiple items into one JSON' n8n node transforms the detailed question array into separate items for bulk insertion. The 'Append Scorecard' n8n node then logs the individual question status (Correct/Incorrect) to a detailed scorecard sheet. This comprehensive n8n workflow ensures full accountability.

Installation Guide

To deploy this powerful n8n workflow template, follow these steps:


  1. Import: Copy the provided JSON code and import it into your n8n instance as a new workflow.

  2. Credentials Setup: You will need to configure credentials for the following services:

Google Gemini (PaLM) API: Required for the 'Analyze an image' and 'Google Gemini Chat Model' n8n node operations. Ensure it has access to multimodal capabilities.
Google Docs OAuth2 API: Needed for the agent tools ('Question Paper 5Th Class' and 'Answer Paper 5th Class') to fetch the document contents.
* Google Sheets OAuth2 API: Needed for the two 'Google Sheets' n8n node operations to write the results.

  1. Document Links: Update the 'Question Paper 5Th Class' and 'Answer Paper 5th Class' n8n node parameters with the correct URLs for your institution's specific question and answer key documents.

  2. Google Sheets Configuration: Configure the 'Append Summary' and 'Append Scorecard' n8n node instances to point to your target Google Sheet ID and specific sheet/tab names where the data should be logged.

  3. Activate: Save and activate the n8n workflow. The 'Answer Sheet Uploader' n8n trigger will provide a public webhook URL to initiate the grading process.

Node Details

Answer Sheet Uploader (Form Trigger): The starting n8n trigger. Collects input from the user (Examiner Name) and handles the file upload of the scanned answer sheet. It is configured to accept PNG or JPG files.
Analyze an image (Google Gemini n8n node): Essential for reading the source material. Function: Analyzes the uploaded binary image, extracts all written text (answers, student name, etc.), and provides the output text for the AI Agent. Key Configuration: Uses models/gemini-2.5-flash and is set to the 'image' resource type, targeting the UploadAnswerSheet binary property.
AI Agent (Agent n8n node): The core intelligence of this n8n workflow. Function: Orchestrates the evaluation, comparing extracted student answers against Google Docs reference tools. It defines complex rules for comparison and scoring. Key Configuration: Uses gemini-2.5-pro via the language model connection, and utilizes 'Question Paper 5Th Class' and 'Answer Paper 5th Class' as tools.
Structured Output Parser1 (Output Parser n8n node): Function: Ensures the output from the 'AI Agent' strictly conforms to a defined JSON schema, guaranteeing reliable downstream processing by Google Sheets n8n node steps.
Append Summary (Google Sheets n8n node): Function: Writes the high-level evaluation metrics (Total Marks, Marks Obtained, correct/incorrect counts) into a designated summary tab. Key Configuration: Operation is set to 'append', mapping specific fields from the AI output JSON.
Code to merge multiple items into one JSON (Code n8n node): Function: Transforms the nested JSON array containing question details into separate items, ensuring each item carries the necessary metadata (like Student Name) required by the subsequent Google Sheets n8n node for detailed logging.


  • Append Scorecard (Google Sheets n8n node): Function: Logs the detailed, question-by-question breakdown (Question, Correct Answer, Student Answer, Status) into a separate scorecard tab. Key Configuration: Operation is 'append' using data restructured by the preceding Code n8n node.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by
Abdul Matheen
Abdul Matheen

I am an automation consultant at a multinational company with 18 years of experience in automation technologies, including RPA, Python, and VBA. I am also expanding my expertise by learning AI Agents to further enhance my skill set. Currently serving as delivery manager for a automation team.

Featured*