Quick Overview
This workflow classifies procurement transactions stored in Google Sheets using Google Gemini with an approved spend taxonomy and prior human feedback, then either auto-updates the transactions and logs results or routes uncertain cases to a reviewer by Gmail and captures the final decision via an n8n form.
How it works
- Runs daily on a schedule trigger and loads workflow settings such as confidence threshold, statuses, and the review recipient email.
- Reads pending transactions, active spend categories, and approved historical classification feedback from Google Sheets and builds a taxonomy plus a limited set of feedback examples.
- For each pending transaction, sends the transaction context, allowed taxonomy, and feedback examples to Google Gemini and parses a structured classification output.
- Validates that the predicted category code and name exist in the active taxonomy and that the confidence score and reasoning fields are present and well-formed.
- If the result is valid, meets the minimum confidence threshold, and has no stated ambiguity, it logs the decision to a Google Sheets audit log and updates the transaction row as Classified with AI details and final category.
- Otherwise, it marks the transaction as Review Required in Google Sheets, logs the event, and emails the reviewer via Gmail with the suggested category, confidence, and validation/ambiguity notes.
- When a reviewer submits the n8n form, the workflow looks up the transaction, validates the chosen category code against the active taxonomy, records the decision as feedback in Google Sheets, updates the transaction with the final category, and appends a human-review audit log entry.
Setup
- Create and connect credentials for Google Sheets, Google Gemini (PaLM/AI Studio), and Gmail.
- Update the Google Sheets document and ensure it contains the required tabs and columns used by the workflow (Procurement Transactions, Spend Categories, Classification Feedback, and Classification Log).
- Set your confidence threshold, status values, max feedback examples, and the reviewer email address in the workflow settings fields.
- Configure the scheduled trigger time and confirm your n8n timezone matches your intended daily run.
- Enable the Human Spend Classification Review form and share its production form URL with reviewers so they can submit final category decisions.