{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "73dafd33-1df4-4c62-a4d6-d19e0c766f44",
      "name": "Monitor Receipts Folder",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "FOLDER_ID_PLACEHOLDER",
          "cachedResultUrl": "https://drive.google.com/drive/folders/FOLDER_ID_PLACEHOLDER",
          "cachedResultName": "Receipts"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2be7a503-6d6c-404b-a42b-970713918e36",
      "name": "Download file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        224,
        0
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "d5f1fe60-fa67-49e0-a45d-62a394d94fa8",
      "name": "Extract Receipt Data with AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        448,
        0
      ],
      "parameters": {
        "text": "Extract the data from the provided receipt image and format it into a strict JSON object.\n\nDo not include markdown formatting or conversational text. Use the following schema and rules:\n\nvendor: (String) The name of the store or merchant.\n\ndate: (String) The date of the transaction converted to DD/MM/YYYY format.\n\nitems: (string) Each item must be a single row formatted exactly as: Name: <item name> - Qty: <quantity> - Total: <total price>, between the items have a newline\n\ntotal: (Float) The grand total amount paid.",
        "options": {
          "passthroughBinaryImages": true
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "2e65cddc-6c72-4fa2-9be0-1035940294e8",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        448,
        224
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini",
          "cachedResultName": "gpt-5-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "df81a3af-667c-4f2f-8277-b675ad239703",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        592,
        224
      ],
      "parameters": {
        "jsonSchemaExample": "{\"vendor\": \"TESCO metro\",  \"date\": \"23/04/2012\", \"items\": \"Name: FRESH MILK - Qty: 1 - Total: 0.89\\nName: MUESLI - Qty: 1 - Total: 2.29\\nName: DARK CHOCOLATE - Qty: 2 - Total: 1.90\", \"total\": 5.08}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "8bdec3f3-0a28-4cd6-9bfe-ec42a3a64311",
      "name": "Append Receipt to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        800,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "date": "={{ $json.output.date }}",
            "items": "={{ $json.output.items }}",
            "total": "={{ $json.output.total }}",
            "vendor": "={{ $json.output.vendor }}"
          },
          "schema": [
            {
              "id": "vendor",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "vendor",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "items",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "items",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "output",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "output",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "SPREADSHEET_ID_PLACEHOLDER"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "3dd92ff8-1e92-49b8-9c05-6e85f5937357",
      "name": "Convert Receipt to HTML Table",
      "type": "n8n-nodes-base.html",
      "position": [
        1008,
        0
      ],
      "parameters": {
        "options": {},
        "operation": "convertToHtmlTable"
      },
      "typeVersion": 1.2
    },
    {
      "id": "031d0812-84dd-4858-9a04-bc01a3c689b5",
      "name": "Send Receipt Email Notification",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1216,
        0
      ],
      "parameters": {
        "sendTo": "john.doe@example.com",
        "message": "={{ $json.table }}",
        "options": {
          "appendAttribution": true
        },
        "subject": "=New receipt Processed from {{ $('Append Receipt to Google Sheet').item.json.vendor }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "doc-note-1769185385297",
      "name": "Workflow Description",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        -150
      ],
      "parameters": {
        "width": 600,
        "height": 1123,
        "content": "## Workflow Overview\n\nThis automation eliminates manual receipt data entry by automatically processing receipt images uploaded to Google Drive. When a new receipt is added to a monitored folder, the workflow extracts key information using AI, logs it to a Google Sheet, and sends you an email notification with the processed data.\n\n### How It Works\n\n1. **Monitor:** The workflow watches a specific Google Drive folder for newly uploaded receipt images\n2. **Download:** When detected, the receipt file is automatically downloaded\n3. **Extract:** An AI Agent analyzes the receipt image and extracts vendor name, date, itemized purchases, and total amount in a structured JSON format\n4. **Log:** The extracted data is automatically appended as a new row in your Google Sheet\n5. **Notify:** You receive an email with an HTML table summarizing the processed receipt\n\n### First Setup\n\n- **Google Drive account:** Connect your Google Drive and configure the trigger to watch your desired receipts folder\n- **OpenAI account:** Required for the AI Agent to process receipt images\n- **Google Sheets:** Make a copy of the provided template spreadsheet to your own account\n- **Gmail account:** Connect for sending notification emails\n\n### Configuration\n\n- **Google Drive folder:** Update the trigger to monitor your specific receipts folder\n- **Google Sheet ID:** Configure the Google Sheets node to point to your copied spreadsheet\n- **Email recipient:** Change the notification email address to your own\n- **AI model:** The workflow uses GPT-4-mini, but you can select a different OpenAI model based on your needs"
      },
      "typeVersion": 1
    },
    {
      "id": "contact-note-1769185448257",
      "name": "Creator Contact Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        -610
      ],
      "parameters": {
        "color": 5,
        "width": 600,
        "height": 440,
        "content": "# Contact Us:\n## Milan @ SmoothWork - [Book a Free Consulting Call](https://smoothwork.ai/book-a-call/)\n![Milan](https://gravatar.com/avatar/95700d17ba300a9f14c1b8cacf933df7720027b3adda9cbe6183d89142925422?r=pg&d=retro&size=100)\n\n\n### We help businesses eliminate busywork by building compact business tools tailored to your process.\n### Contact us for customizing this, or building similar automations.\n\n\ud83d\udce7 hello@smoothwork.ai\n\u25b6\ufe0f [Check us on YouTube](https://www.youtube.com/@vasarmilan)\n\ud83d\udcde [Book a Free Consulting Call](https://smoothwork.ai/book-a-call/)\n\ud83d\udcbc [Add me on Linkedin](https://www.linkedin.com/in/mil%C3%A1n-v%C3%A1s%C3%A1rhelyi-3a9985123/)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "video-note-1769187077818",
      "name": "Video Walkthrough",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -90,
        -610
      ],
      "parameters": {
        "width": 420,
        "height": 340,
        "content": "# Video Walkthrough\n[![image.png](https://vasarmilan-public.s3.us-east-1.amazonaws.com/blog_thumbnails/thumbnail_rec5dRs6sFpgUZ675.jpg)](https://youtu.be/Vl0wCc9pEGM)"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Download file": {
      "main": [
        [
          {
            "node": "Extract Receipt Data with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Extract Receipt Data with AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Monitor Receipts Folder": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Extract Receipt Data with AI",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Extract Receipt Data with AI": {
      "main": [
        [
          {
            "node": "Append Receipt to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Receipt to HTML Table": {
      "main": [
        [
          {
            "node": "Send Receipt Email Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append Receipt to Google Sheet": {
      "main": [
        [
          {
            "node": "Convert Receipt to HTML Table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Receipt Email Notification": {
      "main": [
        []
      ]
    }
  }
}