AutomationFlowsAI & RAG › Extract and Log Invoice Data to Google Sheets with Ainoflow and Chatgpt

Extract and Log Invoice Data to Google Sheets with Ainoflow and Chatgpt

ByOriol Seguí @oxsr11 on n8n.io

Every time a new invoice lands in your inbox, this workflow reads it, extracts all the relevant data using AI, and logs everything into a Google Sheets spreadsheet automatically. No copy-pasting, no forgotten invoices, no duplicate entries.

Cron / scheduled trigger★★★★★ complexityAI-powered30 nodesHTTP Request@Ainoflow/N8N Nodes AinoflowOpenRouter ChatAgentGmailStop And ErrorGoogle SheetsOpenAI Chat
AI & RAG Trigger: Cron / scheduled Nodes: 30 Complexity: ★★★★★ AI nodes: yes Added:

This workflow corresponds to n8n.io template #15067 — we link there as the canonical source.

This workflow follows the Agent → Gmail 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 →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "07beeb99-59c2-4417-9582-50aaa7a0a3cf",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "maxTries": 2,
      "position": [
        -416,
        32
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.4,
      "waitBetweenTries": 5000
    },
    {
      "id": "bf45bc19-fbe9-47ac-a00f-63460877e01e",
      "name": "Campos Factura",
      "type": "n8n-nodes-base.set",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        208,
        -256
      ],
      "parameters": {},
      "retryOnFail": false,
      "typeVersion": 3.4,
      "alwaysOutputData": false,
      "waitBetweenTries": 5000
    },
    {
      "id": "ed35ec70-b103-42ee-ace7-776966743e44",
      "name": "Convert",
      "type": "@ainoflow/n8n-nodes-ainoflow.ainoflowConvert",
      "onError": "continueErrorOutput",
      "position": [
        -624,
        32
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 1,
      "waitBetweenTries": 5000
    },
    {
      "id": "51ba27ba-9576-45f6-826a-7d2b5bd80ede",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -352,
        240
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "627503a1-de9a-4a0d-925a-6344882c7bc0",
      "name": "Clear json",
      "type": "n8n-nodes-base.code",
      "position": [
        192,
        240
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "6dfafb36-2740-4160-b5e1-e4e52d8dfe9d",
      "name": "Invoice to JSON",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "maxTries": 2,
      "position": [
        -192,
        32
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 3.1,
      "waitBetweenTries": 5000
    },
    {
      "id": "1db58fff-0b8f-404e-8ee8-c9cc5deaa93a",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -624,
        256
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "6ac246e7-73ab-41d2-bced-904eae486f92",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -624,
        -256
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "05181616-652b-4230-9a53-ad81334530eb",
      "name": "Stop and Error",
      "type": "n8n-nodes-base.stopAndError",
      "position": [
        -208,
        -400
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "19996fc0-367d-4bb8-bca2-5a0275486a5c",
      "name": "Get invoice",
      "type": "n8n-nodes-base.gmail",
      "onError": "continueErrorOutput",
      "maxTries": 2,
      "position": [
        -208,
        -256
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2.2,
      "waitBetweenTries": 5000
    },
    {
      "id": "4be8bea9-73a8-4001-8e2a-31fd68c4e1f7",
      "name": "invoice clear",
      "type": "n8n-nodes-base.code",
      "position": [
        0,
        -256
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "37b23263-d177-4bc9-9fb0-f991e17f964d",
      "name": "OPTIONS",
      "type": "n8n-nodes-base.set",
      "position": [
        -416,
        -256
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "6dd48397-fed1-432c-ade2-073a536b098a",
      "name": "Get row(s) in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueRegularOutput",
      "maxTries": 2,
      "position": [
        -624,
        592
      ],
      "parameters": {},
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 4.7,
      "alwaysOutputData": true,
      "waitBetweenTries": 5000
    },
    {
      "id": "6ebedfc8-fafc-4970-b741-60b5fe4eff86",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "disabled": true,
      "position": [
        -448,
        592
      ],
      "parameters": {},
      "typeVersion": 2.3
    },
    {
      "id": "253d3ecf-d37e-4b69-bba7-6c74f12b4b25",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -224,
        688
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.7,
      "waitBetweenTries": 5000
    },
    {
      "id": "4dc22cb3-336a-4aa8-9442-6dbe6621e49e",
      "name": "Invoice Repeat",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -96,
        544
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "9ec9ec81-d16f-4cd2-aa67-6e94dbd5068c",
      "name": "Success",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -48,
        688
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "e8d1bbda-05bf-492b-a5f2-f0fac8757d99",
      "name": "Move invoice",
      "type": "n8n-nodes-base.gmail",
      "position": [
        128,
        688
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "290a4fb2-f5cf-4484-ac18-ef95d71ac756",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        -448
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a92b2cdd-8023-4d57-bec5-b0cfd3074cd9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        0
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1ee8f8d7-d105-4cbe-8247-684c8b5b260d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        480
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "7f791af0-1c28-482c-b1a2-494b14f22c32",
      "name": "Remove label",
      "type": "n8n-nodes-base.gmail",
      "position": [
        304,
        688
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "b181edb9-800c-48ab-9538-14f8f7937c87",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -448
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "d97c9b42-3653-4276-bdf9-32d592f0e8d2",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        0
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "720c5212-3b39-4db7-8754-f60eadfb8dfe",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        480
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2628c736-19e9-40f6-ac19-8472d8d5d9a1",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        -448
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "6ce9d1c1-ffaf-4f50-ad1f-779cb59342ca",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        0
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "6e2d8745-5e4c-4858-be5c-4e64999cbd89",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        160
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2c467a4d-a5e7-4e7d-b0e4-b084e03f376a",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -192,
        240
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "7245d89e-cdad-488c-99f5-812fc395b71d",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        320
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Invoice Repeat",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OPTIONS": {
      "main": [
        [
          {
            "node": "Get invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Success": {
      "main": [
        [
          {
            "node": "Move invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clear json": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get invoice": {
      "main": [
        [
          {
            "node": "invoice clear",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Stop and Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Invoice to JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Move invoice": {
      "main": [
        [
          {
            "node": "Remove label",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "invoice clear": {
      "main": [
        [
          {
            "node": "Campos Factura",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Campos Factura": {
      "main": [
        [
          {
            "node": "Convert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Invoice to JSON": {
      "main": [
        [
          {
            "node": "Clear json",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "OPTIONS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Invoice to JSON",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        []
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Every time a new invoice lands in your inbox, this workflow reads it, extracts all the relevant data using AI, and logs everything into a Google Sheets spreadsheet automatically. No copy-pasting, no forgotten invoices, no duplicate entries.

Source: https://n8n.io/workflows/15067/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow automates the creation, rendering, approval, and posting of TikTok-style POV (Point of View) videos to Instagram, with cross-posting to Facebook and YouTube. It eliminates manual video p

OpenAI Chat, Output Parser Item List, HTTP Request +10
AI & RAG

This n8n automation workflow automates the creation, scripting, production, and posting of YouTube videos. It leverages AI (OpenAI), image generation (PIAPI), video rendering (Shotstack), and platform

Agent, OpenAI Chat, Airtable Tool +7
AI & RAG

Created by: Peyton Leveillee Last updated: October 2025

OpenAI Chat, Google Sheets, HTTP Request +5
AI & RAG

The Multi-Model Agency Content Engine is a high-performance editorial system designed for agencies. It solves the "blank page" problem by alternating between real-world social proof and strategic expe

Google Sheets, Gmail, Google Drive +6
AI & RAG

This n8n workflow turns a script and character/setting description from Google Sheets into a complete stitched UGC-style video ad, fully automated from intake to final delivery.

Google Sheets, HTTP Request, OpenRouter Chat +7