This workflow corresponds to n8n.io template #17276 — we link there as the canonical source.
This workflow follows the Gmail → Google Sheets recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "8mqaXR321JfVkfdC",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Autonomous Purchase Order Creation Workflow",
"tags": [],
"nodes": [
{
"id": "c8303c2c-b341-441e-90b4-c536d0b406a1",
"name": "Schedule - Procurement Scan",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1408,
16
],
"parameters": {
"rule": {
"interval": [
{
"field": "minutes",
"minutesInterval": 15
}
]
}
},
"typeVersion": 1.3
},
{
"id": "bc11dce7-8f14-4622-9399-22eabb30afdb",
"name": "Read - New Requisitions",
"type": "n8n-nodes-base.googleSheets",
"position": [
-1184,
16
],
"parameters": {
"options": {},
"filtersUI": {
"values": []
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 394452034,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit#gid=394452034",
"cachedResultName": "Requisitions"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit?usp=drivesdk",
"cachedResultName": "Autonomous_Procurement_System"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "d4823f7a-475c-4dfc-98d7-9d8c763a1997",
"name": "Filter - Approved & New Requests",
"type": "n8n-nodes-base.filter",
"position": [
-960,
16
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "e8972406-3426-4ced-878f-77b1dc3ec96a",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.ApprovalStatus }}",
"rightValue": "=Approved"
},
{
"id": "68b84c4d-4c82-4f84-b92c-43df245c2cf4",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.ProcessingStatus }}",
"rightValue": "New"
}
]
}
},
"typeVersion": 2.3
},
{
"id": "3c1664e3-f9b5-4116-9850-1f869ad6d4cf",
"name": "Read - Supplier Master Data",
"type": "n8n-nodes-base.googleSheets",
"position": [
-736,
16
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.SupplierID }}",
"lookupColumn": "SupplierID"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit#gid=0",
"cachedResultName": "Suppliers"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit?usp=drivesdk",
"cachedResultName": "Autonomous_Procurement_System"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.5,
"alwaysOutputData": false
},
{
"id": "7511652e-ed1a-4ff5-a5e8-35441efb1feb",
"name": "Code - Merge Supplier Details",
"type": "n8n-nodes-base.code",
"position": [
-512,
16
],
"parameters": {
"jsCode": "// Requisitions from previous node\nconst requisitions = $('Read - New Requisitions').all().map(i => i.json);\n\n// Suppliers coming into this node\nconst suppliers = $input.all().map(i => i.json);\n\nconst results = [];\n\nfor (const req of requisitions) {\n\n const supplier = suppliers.find(\n s => String(s.SupplierID).trim() === String(req.SupplierID).trim()\n );\n\n results.push({\n json: {\n ...req,\n\n SupplierFound: !!supplier,\n SupplierName: supplier?.SupplierName || null,\n SupplierStatus: supplier?.Status || null,\n ContractActive: supplier?.ContractActive || null,\n ComplianceStatus: supplier?.ComplianceStatus || null,\n MaxLimit: supplier?.MaxLimit || null,\n Category: supplier?.Category || null\n }\n });\n}\n\nreturn results;"
},
"typeVersion": 2
},
{
"id": "add01304-49f3-4254-a010-62f18860a25e",
"name": "Check - Existing Purchase Order",
"type": "n8n-nodes-base.if",
"position": [
-288,
16
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "c1",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.ApprovalStatus }}",
"rightValue": "Approved"
},
{
"id": "7380875a-eb80-44c6-b2ad-20d3eb2599b4",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.ProcessingStatus }}",
"rightValue": "New"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "6d8f993f-fca2-4b8e-a8e0-3d1aa4a50d0b",
"name": "End - Duplicate Request",
"type": "n8n-nodes-base.noOp",
"position": [
-64,
112
],
"parameters": {},
"typeVersion": 1
},
{
"id": "5e2267dc-5d14-4c87-8e8a-bdf96a171f79",
"name": "Code - Procurement Validation",
"type": "n8n-nodes-base.code",
"position": [
-64,
-80
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "let validationStatus = \"PASS\";\nlet validationReason = \"Validation passed\";\n\nif (!$json.SupplierFound) {\n validationStatus = \"FAIL\";\n validationReason = \"Supplier not found\";\n}\nelse if ($json.SupplierStatus !== \"Active\") {\n validationStatus = \"FAIL\";\n validationReason = \"Supplier is not active\";\n}\nelse if ($json.ContractActive !== \"Yes\") {\n validationStatus = \"FAIL\";\n validationReason = \"Contract is not active\";\n}\nelse if ($json.ComplianceStatus !== \"Compliant\") {\n validationStatus = \"FAIL\";\n validationReason = \"Supplier compliance issue\";\n}\nelse if (Number($json.TotalAmount) > Number($json.MaxLimit)) {\n validationStatus = \"FAIL\";\n validationReason =\n `Amount exceeds supplier limit (${ $json.MaxLimit })`;\n}\n\nreturn {\n json: {\n ...$json,\n validationStatus,\n validationReason\n }\n};"
},
"typeVersion": 2
},
{
"id": "798e9790-4dbf-41b4-a611-7db3f615ef11",
"name": "AI - Risk Assessment",
"type": "n8n-nodes-base.httpRequest",
"position": [
384,
-176
],
"parameters": {
"url": "",
"method": "POST",
"options": {},
"jsonBody": "={{ JSON.stringify({model: 'llama-3.3-70b-versatile',temperature: 0.2,response_format: {type: 'json_object'},messages: [{role: 'system', content: 'You are a strict procurement compliance validator for an autonomous purchase order system. Respond ONLY with valid JSON in this exact shape: {\\\"decision\\\": \\\"APPROVED\\\" or \\\"NEEDS_REVIEW\\\" or \\\"REJECTED\\\", \\\"risk_score\\\": a number 0-100, \\\"reason\\\": a short one-sentence explanation}. No extra text.'},{role: 'user', content: 'Requisition ' + $json.ReqID + ': Item=' + $json.ItemName + ', Qty=' + $json.Quantity + ', UnitPrice=' + $json.UnitPrice + ', Total=' + $json.Currency + ' ' + $json.TotalAmount + '. Supplier=' + ($json.SupplierName || 'NOT FOUND') + ', SupplierStatus=' + $json.SupplierStatus + ', ContractActive=' + $json.ContractActive + ', MaxLimit=' + $json.MaxLimit + ', ComplianceStatus=' + $json.ComplianceStatus + '. Evaluate: is the supplier active and compliant, is the contract active, and is the total within the supplier max limit? Flag anything unusual.'}]}) }}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "5287c40d-093e-4bbb-9323-10a9d98e8d4c",
"name": "Check Validation",
"type": "n8n-nodes-base.if",
"position": [
160,
-80
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a34d0f0a-2fa6-4a22-8aea-a980adf7ee4f",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.validationStatus }}",
"rightValue": "PASS"
}
]
}
},
"typeVersion": 2.3
},
{
"id": "e0db9015-7675-4993-ad43-8eab2ade08cf",
"name": "Create - Rejection Audit",
"type": "n8n-nodes-base.googleSheets",
"position": [
384,
16
],
"parameters": {
"columns": {
"value": {
"Step": "BUSINESS_VALIDATION",
"ReqID": "={{ $json.ReqID }}",
"Result": "FAILED",
"Details": "={{ $json.validationReason }}",
"EventID": "={{'EVT-' + $now.toFormat('yyyyMMddHHmmss') + '-' + $json.ReqID}}",
"Timestamp": "={{$now.toISO()}}"
},
"schema": [
{
"id": "EventID",
"type": "string",
"display": true,
"required": false,
"displayName": "EventID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ReqID",
"type": "string",
"display": true,
"required": false,
"displayName": "ReqID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Step",
"type": "string",
"display": true,
"required": false,
"displayName": "Step",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Result",
"type": "string",
"display": true,
"required": false,
"displayName": "Result",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Details",
"type": "string",
"display": true,
"required": false,
"displayName": "Details",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Timestamp",
"type": "string",
"display": true,
"required": false,
"displayName": "Timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 862675080,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit#gid=862675080",
"cachedResultName": "Audit_Logs"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit?usp=drivesdk",
"cachedResultName": "Autonomous_Procurement_System"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "9ee358f6-8b24-4380-bdf3-0246f361d3d0",
"name": "Update - Requisition Rejected",
"type": "n8n-nodes-base.googleSheets",
"position": [
608,
16
],
"parameters": {
"columns": {
"value": {
"ReqID": "={{ $json.ReqID }}",
"ProcessingStatus": "Rejected"
},
"schema": [
{
"id": "ReqID",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "ReqID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "RequestedBy",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "RequestedBy",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Department",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Department",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "SupplierID",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "SupplierID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ItemName",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "ItemName",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Quantity",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Quantity",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "UnitPrice",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "UnitPrice",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TotalAmount",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "TotalAmount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Currency",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Currency",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ApprovalStatus",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "ApprovalStatus",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ProcessingStatus",
"type": "string",
"display": true,
"required": false,
"displayName": "ProcessingStatus",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "RequestDate",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "RequestDate",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"ReqID"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 394452034,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit#gid=394452034",
"cachedResultName": "Requisitions"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit?usp=drivesdk",
"cachedResultName": "Autonomous_Procurement_System"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "b1bc6cdf-de23-47a3-ab26-55a85c483bdb",
"name": "Code - Generate Purchase Order",
"type": "n8n-nodes-base.code",
"position": [
608,
-176
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const ai = JSON.parse(\n $json.choices[0].message.content\n);\n\nconst poNumber =\n 'PO-' +\n Date.now();\n\nreturn {\n json: {\n ...$('Code - Procurement Validation').item.json,\n RiskScore: ai.risk_score,\n AIReason: ai.reason,\n AIDecision: ai.decision,\n PONumber: poNumber,\n CreatedAt: new Date().toISOString()\n }\n};"
},
"typeVersion": 2
},
{
"id": "edc65c52-84ea-436e-bbdd-b16744a3d0da",
"name": "Create - Purchase Order Record",
"type": "n8n-nodes-base.googleSheets",
"position": [
832,
-176
],
"parameters": {
"columns": {
"value": {
"ReqID": "={{ $json.ReqID }}",
"Status": "Approved",
"AIReason": "={{ $json.AIReason }}",
"Currency": "={{ $json.Currency }}",
"ItemName": "={{ $json.ItemName }}",
"PONumber": "={{ $json.PONumber }}",
"Quantity": "={{ $json.Quantity }}",
"CreatedAt": "={{ $json.CreatedAt }}",
"RiskScore": "={{ $json.RiskScore }}",
"UnitPrice": "={{ $json.UnitPrice }}",
"SupplierID": "={{ $json.SupplierID }}",
"TotalAmount": "={{ $json.TotalAmount }}",
"SupplierName": "={{ $json.SupplierName }}"
},
"schema": [
{
"id": "PONumber",
"type": "string",
"display": true,
"required": false,
"displayName": "PONumber",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ReqID",
"type": "string",
"display": true,
"required": false,
"displayName": "ReqID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "SupplierID",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "SupplierID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "SupplierName",
"type": "string",
"display": true,
"required": false,
"displayName": "SupplierName",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ItemName",
"type": "string",
"display": true,
"required": false,
"displayName": "ItemName",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Quantity",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Quantity",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "UnitPrice",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "UnitPrice",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TotalAmount",
"type": "string",
"display": true,
"required": false,
"displayName": "TotalAmount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Currency",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Currency",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "RiskScore",
"type": "string",
"display": true,
"required": false,
"displayName": "RiskScore",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "AIReason",
"type": "string",
"display": true,
"required": false,
"displayName": "AIReason",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Status",
"type": "string",
"display": true,
"required": false,
"displayName": "Status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "CreatedAt",
"type": "string",
"display": true,
"required": false,
"displayName": "CreatedAt",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 349383385,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit#gid=349383385",
"cachedResultName": "Purchase_Orders"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit?usp=drivesdk",
"cachedResultName": "Autonomous_Procurement_System"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.5
},
{
"id": "37b8b9e4-eb03-46da-ac4b-65678da9f765",
"name": "Update - Requisition Processed",
"type": "n8n-nodes-base.googleSheets",
"position": [
1056,
-80
],
"parameters": {
"columns": {
"value": {
"ReqID": "={{$json.ReqID}}",
"ProcessingStatus": "Processed"
},
"schema": [
{
"id": "ReqID",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "ReqID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "RequestedBy",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "RequestedBy",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Department",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Department",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "SupplierID",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "SupplierID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ItemName",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "ItemName",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Quantity",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Quantity",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "UnitPrice",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "UnitPrice",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TotalAmount",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "TotalAmount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Currency",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Currency",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ApprovalStatus",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "ApprovalStatus",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ProcessingStatus",
"type": "string",
"display": true,
"required": false,
"displayName": "ProcessingStatus",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "RequestDate",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "RequestDate",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"ReqID"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 394452034,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit#gid=394452034",
"cachedResultName": "Requisitions"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit?usp=drivesdk",
"cachedResultName": "Autonomous_Procurement_System"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "2218db8f-0ec0-4c03-b6a4-1b6898a50df8",
"name": "Create - Audit Trail",
"type": "n8n-nodes-base.googleSheets",
"position": [
1056,
-272
],
"parameters": {
"columns": {
"value": {
"Step": "PO_CREATION",
"ReqID": "={{$json.ReqID}}",
"Result": "SUCCESS",
"Details": "={{\"PO Created: \" + $json.PONumber}}",
"EventID": "={{\"EVT-\" + $now.toFormat(\"yyyyMMddHHmmss\")}}",
"Timestamp": "={{$now.toISO()}}"
},
"schema": [
{
"id": "EventID",
"type": "string",
"display": true,
"required": false,
"displayName": "EventID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ReqID",
"type": "string",
"display": true,
"required": false,
"displayName": "ReqID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Step",
"type": "string",
"display": true,
"required": false,
"displayName": "Step",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Result",
"type": "string",
"display": true,
"required": false,
"displayName": "Result",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Details",
"type": "string",
"display": true,
"required": false,
"displayName": "Details",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Timestamp",
"type": "string",
"display": true,
"required": false,
"displayName": "Timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 862675080,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit#gid=862675080",
"cachedResultName": "Audit_Logs"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1kiZ1930Z8rASFn7V18BVluTgV6uRwPsIfgS2GbuRE-I/edit?usp=drivesdk",
"cachedResultName": "Autonomous_Procurement_System"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.5
},
{
"id": "94e6a19b-858a-48a9-b911-4db0c1803ea9",
"name": "Set - Notification Payload",
"type": "n8n-nodes-base.set",
"position": [
1296,
-160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "13decc83-bac7-40a9-bf02-88b04e41e1dd",
"name": "PONumber",
"type": "string",
"value": "={{ $('Create - Purchase Order Record').item.json.PONumber }}"
},
{
"id": "b8f97419-8675-4e9b-98e3-7d5bf4f90f1f",
"name": "ReqID",
"type": "string",
"value": "={{ $('Create - Purchase Order Record').item.json.ReqID }}"
},
{
"id": "65f090b4-9d33-43cc-87d3-70d1614cbd22",
"name": "SupplierName",
"type": "string",
"value": "={{ $('Create - Purchase Order Record').item.json.SupplierName }}"
},
{
"id": "0cee7d02-9e05-43dd-a6d1-3eb557e31a17",
"name": "NotificationSubject",
"type": "string",
"value": "=Purchase Order Created - {{ $('Create - Purchase Order Record').item.json.PONumber }}"
},
{
"id": "9550d1bf-721c-476a-ba36-cf98374d495e",
"name": "NotificationMessage",
"type": "string",
"value": "=PO {{ $('Create - Purchase Order Record').item.json.PONumber }} created successfully for {{ $('Create - Purchase Order Record').item.json.SupplierName }}"
},
{
"id": "723e4ea3-339f-46d3-a97b-9d10c316a8dc",
"name": "NotificationStatus",
"type": "string",
"value": "={{ $('Code - Generate Purchase Order').item.json.AIDecision }}"
},
{
"id": "4e2c345e-d325-4bd8-9eda-0e94ad93b72c",
"name": "NotificationAmount",
"type": "string",
"value": "={{ $('Create - Purchase Order Record').item.json.Currency + ' ' + $('Create - Purchase Order Record').item.json.TotalAmount}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "4013d2b9-6e48-45ab-8e35-4c13292ca448",
"name": "Notify - Procurement Team",
"type": "n8n-nodes-base.gmail",
"position": [
1504,
-160
],
"parameters": {
"sendTo": "",
"message": "=<p>{{$json.NotificationMessage}}</p>\n\n<p>\n<b>ReqID:</b> {{$json.ReqID}}<br>\n<b>Supplier:</b> {{$json.SupplierName}}<br>\n<b>Item:</b> {{ $('Create - Purchase Order Record').item.json.ItemName }}<br>\n<b>Amount:</b> {{$json.NotificationAmount}}<br>\n<b>Risk Score:</b> {{ $('Create - Purchase Order Record').item.json.RiskScore }}<br>\n<b>AI Reason:</b> {{ $('Create - Purchase Order Record').item.json.AIReason }}</p>",
"options": {
"appendAttribution": false
},
"subject": "={{$json.NotificationSubject}}"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "560a1adb-7aab-42a3-8e2e-afef2832c222",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2208,
-1008
],
"parameters": {
"width": 704,
"height": 784,
"content": "## Autonomous Purchase Order Creation Workflow\n\n\nThis workflow automates the procurement process by converting approved requisitions into purchase orders with minimal human intervention.\n\nThe process begins by scanning the Approved_Requisitions sheet for records that are approved and not yet processed. Supplier information is then matched against the Suppliers master sheet to validate supplier availability, contract status, compliance status, and spending limits.\n\nBefore creating a purchase order, duplicate checks ensure that the same requisition is not processed multiple times. Business validation rules filter out requests that violate procurement policies. Valid requests are sent to an AI risk assessment stage powered by Groq, which provides a risk score and decision reasoning.\n\nApproved requests are transformed into purchase orders and stored in the Purchase_Orders sheet. All actions are logged in Audit_Logs for traceability. Requisition records are updated to prevent reprocessing, and stakeholders receive email notifications containing purchase order details.\n\n### Required Setup:\n\u2022 Google Sheets credentials\n\u2022 Groq API credential\n\u2022 Gmail credential\n\u2022 Spreadsheet with required sheets"
},
"typeVersion": 1
},
{
"id": "60084d3c-e461-4917-adf6-a60c6871f2e8",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1472,
-496
],
"parameters": {
"color": 7,
"width": 672,
"height": 752,
"content": "## Requisition Intake & Data Collection\n\nThis section initiates the procurement workflow by scanning the Approved_Requisitions sheet on a scheduled basis. Only approved requests that have not yet been processed are selected for further evaluation. The purpose of this stage is to ensure that downstream validation and purchase order creation operate on clean, eligible, and actionable procurement requests."
},
"typeVersion": 1
},
{
"id": "35c05e1f-2ce8-4e08-98cb-2e66a0732a52",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-784,
-496
],
"parameters": {
"color": 7,
"width": 640,
"height": 752,
"content": "## Supplier Verification & Duplicate Prevention\n\nThis section enriches requisition records with supplier master data and prevents duplicate purchase order generation. Supplier details such as contract status, compliance status, and spending limits are retrieved and attached to each request. Existing purchase orders are checked to ensure the same requisition is never processed more than once."
},
"typeVersion": 1
},
{
"id": "04ea1f44-55e3-49be-a3e6-638d3fcff999",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-128,
-496
],
"parameters": {
"color": 7,
"width": 416,
"height": 752,
"content": "## Procurement Policy Validation\n\nThis stage applies procurement business rules before AI evaluation. Requests are validated against supplier availability, active contracts, compliance requirements, and spending thresholds. Any requisition that violates company procurement policies is automatically rejected, logged for audit purposes, and prevented from continuing through the purchase order creation process."
},
"typeVersion": 1
},
{
"id": "9544cb49-7b32-4778-90b7-2da91b42eccd",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
304,
-496
],
"parameters": {
"color": 7,
"width": 464,
"height": 496,
"content": "## AI Risk Assessment & PO Generation\n\nThis section uses Groq AI to perform an additional procurement risk review. The AI generates a decision, risk score, and explanation based on supplier and requisition details. Approved requests are then transformed into structured purchase orders with unique identifiers, ensuring standardized and traceable procurement record creation."
},
"typeVersion": 1
},
{
"id": "cb5328fb-afa2-483e-9986-25ecb12269a6",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
784,
-496
],
"parameters": {
"color": 7,
"width": 960,
"height": 592,
"content": "## Purchase Order Processing & Notifications\n\nThis final section records procurement outcomes and communicates results to stakeholders. Purchase orders are stored in the Purchase_Orders sheet, requisition statuses are updated to prevent reprocessing, and audit entries are created for traceability. Notification data is prepared and delivered through email, ensuring visibility into completed procurement activities."
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"availableInMCP": false,
"executionOrder": "v1"
},
"versionId": "971585ea-147a-4fb1-b9f0-cd26621dc6b1",
"nodeGroups": [],
"connections": {
"Check Validation": {
"main": [
[
{
"node": "AI - Risk Assessment",
"type": "main",
"index": 0
}
],
[
{
"node": "Create - Rejection Audit",
"type": "main",
"index": 0
}
]
]
},
"AI - Risk Assessment": {
"main": [
[
{
"node": "Code - Generate Purchase Order",
"type": "main",
"index": 0
}
]
]
},
"Create - Audit Trail": {
"main": [
[
{
"node": "Set - Notification Payload",
"type": "main",
"index": 0
}
]
]
},
"Read - New Requisitions": {
"main": [
[
{
"node": "Filter - Approved & New Requests",
"type": "main",
"index": 0
}
]
]
},
"Create - Rejection Audit": {
"main": [
[
{
"node": "Update - Requisition Rejected",
"type": "main",
"index": 0
}
]
]
},
"Set - Notification Payload": {
"main": [
[
{
"node": "Notify - Procurement Team",
"type": "main",
"index": 0
}
]
]
},
"Read - Supplier Master Data": {
"main": [
[
{
"node": "Code - Merge Supplier Details",
"type": "main",
"index": 0
}
]
]
},
"Schedule - Procurement Scan": {
"main": [
[
{
"node": "Read - New Requisitions",
"type": "main",
"index": 0
}
]
]
},
"Code - Merge Supplier Details": {
"main": [
[
{
"node": "Check - Existing Purchase Order",
"type": "main",
"index": 0
}
]
]
},
"Code - Procurement Validation": {
"main": [
[
{
"node": "Check Validation",
"type": "main",
"index": 0
}
]
]
},
"Code - Generate Purchase Order": {
"main": [
[
{
"node": "Create - Purchase Order Record",
"type": "main",
"index": 0
}
]
]
},
"Create - Purchase Order Record": {
"main": [
[
{
"node": "Create - Audit Trail",
"type": "main",
"index": 0
},
{
"node": "Update - Requisition Processed",
"type": "main",
"index": 0
}
]
]
},
"Update - Requisition Processed": {
"main": [
[
{
"node": "Set - Notification Payload",
"type": "main",
"index": 0
}
]
]
},
"Check - Existing Purchase Order": {
"main": [
[
{
"node": "Code - Procurement Validation",
"type": "main",
"index": 0
}
],
[
{
"node": "End - Duplicate Request",
"type": "main",
"index": 0
}
]
]
},
"Filter - Approved & New Requests": {
"main": [
[
{
"node": "Read - Supplier Master Data",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2googleSheetsOAuth2ApihttpHeaderAuth
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow runs every 15 minutes to read approved, new requisitions from Google Sheets, validate supplier and policy rules, call an LLM risk-assessment API via HTTP, then create a purchase order record, update requisition status, write audit logs, and notify the procurement…
Source: https://n8n.io/workflows/17276/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
YOUR_ID 4. Uses gmail, googleDrive, googleSheets, httpRequest. Scheduled trigger; 53 nodes.
Looking for a way to track GitHub bounty issues automatically and get notified in real time? This GitHub Bounty Tracker workflow monitors repositories for issues labeled 💎 Bounty, logs them in Google
This workflow automatically sends a beautifully designed HTML newsletter every Sunday at 8 AM, featuring products currently on sale from your Algolia-powered e-commerce store.
This n8n template demonstrates how to build a Auto Lead Gen & Outreach System for Local Businesses specifically designed to help businesses that don’t have a website yet.
I created this workflow with care for marketing professionals and agencies who manage multiple Meta Ads (Facebook) accounts and want to track ad account balances automatically — no more logging in eve