{
  "name": "Extract text from Google Drive files to Google Sheets using NVIDIA NIM",
  "nodes": [
    {
      "id": "2a534e69-eb9d-4573-a57b-7e9222984945",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -144
      ],
      "parameters": {
        "width": 420,
        "height": 732,
        "content": "# Extract Text From Google Drive Files\n\n**Who it's for:** Teams and individuals who need to automatically capture, structure, and log content from files dropped into a shared Google Drive folder.\n\n**W"
      }
    },
    {
      "id": "3bea1e63-9a5d-46b7-a64c-871ccfcbe7b0",
      "name": "Section - Trigger and Input",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        -144
      ],
      "parameters": {
        "width": 606,
        "height": 740,
        "content": "## Step 1 — Config\n\nThis workflow watches a specific Google Drive folder every minute, normalizes file metadata, and routes each file by MIME type.\n\nBefore testing:\n- Replace `REPLACE_WITH_GOOGLE_DRIV"
      }
    },
    {
      "id": "cf8e5a70-a356-4928-a439-a07218e2fd80",
      "name": "Section - File Fetching",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        80
      ],
      "parameters": {
        "width": 540,
        "height": 514,
        "content": "## File Fetching\nDownloads the file binary from Drive for local extraction (PDF, image, TXT, CSV) or fetches Google Doc content directly via the Docs API."
      }
    },
    {
      "id": "c30bf8b9-954b-40b3-9afb-b3b06da0ccf4",
      "name": "Section - Extraction Branches",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        -128
      ],
      "parameters": {
        "width": 476,
        "height": 1056,
        "content": "## Extraction Branches\nExtracts raw text from each supported file type.\n- **PDF** — native Extract from File node\n- **TXT** — native Extract from File node\n- **CSV** — parsed to JSON rows\n- **Image** "
      }
    },
    {
      "id": "b401ae90-c106-4686-8a3c-e069984cd9e2",
      "name": "Section - Fallback Paths",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        640
      ],
      "parameters": {
        "width": 536,
        "height": 628,
        "content": "## Fallback Paths\nRaw text inputs bypass extraction entirely.\n\nUnsupported MIME types send a Telegram notification and stop — no Sheets row is written."
      }
    },
    {
      "id": "9f515b82-5e33-4b1e-aade-e15632f5ac62",
      "name": "Section - AI Structuring",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1792,
        80
      ],
      "parameters": {
        "width": 884,
        "height": 558,
        "content": "## AI Structuring with NVIDIA NIM\nSends extracted text to `nvidia/llama-3.3-nemotron-super-49b-v1.5` with a guided JSON schema. Returns: title, summary, category, language, key points, and confidence "
      }
    },
    {
      "id": "06c5660f-6546-4c81-9b74-424248fc3a62",
      "name": "Section - Log and Notify",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2720,
        16
      ],
      "parameters": {
        "width": 510,
        "height": 736,
        "content": "## Step 3 — Delivery\n\nThis workflow delivers output in two places:\n\n- `Append Row in Sheet` writes a structured row to the `Extract_Log` tab\n- `Send Reply` sends a short Telegram confirmation message\n"
      }
    },
    {
      "id": "f001b69a-0fee-413d-930a-b558021c9d02",
      "name": "Google Drive Trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        144,
        304
      ]
    },
    {
      "id": "ce0aacba-4dcf-4a66-a5f6-8b2a719dadd1",
      "name": "Normalize Input",
      "type": "n8n-nodes-base.code",
      "position": [
        336,
        304
      ]
    },
    {
      "id": "9d174ac1-d0d4-4abf-9922-d3646a5107a4",
      "name": "Route Input",
      "type": "n8n-nodes-base.switch",
      "position": [
        576,
        304
      ]
    },
    {
      "id": "c6e2b331-1781-4f5f-9750-f3c3eba0fbfc",
      "name": "Download Drive File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        832,
        240
      ]
    },
    {
      "id": "abddb5e5-6994-47f6-b766-65e388014cdf",
      "name": "Route Downloaded File",
      "type": "n8n-nodes-base.switch",
      "position": [
        1072,
        208
      ]
    },
    {
      "id": "9f0b9eaf-2ae4-4666-a35f-2f89b585a5cf",
      "name": "Get Google Doc",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        832,
        432
      ]
    },
    {
      "id": "96709023-7020-49c3-a2ce-ae6280e3b11b",
      "name": "Normalize Google Doc",
      "type": "n8n-nodes-base.code",
      "position": [
        1072,
        432
      ]
    },
    {
      "id": "db8828df-f8f1-4a92-977d-b2d0fa960f45",
      "name": "Extract from PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1328,
        112
      ]
    },
    {
      "id": "6753414a-fa67-4168-9bff-9b6379ecdd9e",
      "name": "Normalize PDF",
      "type": "n8n-nodes-base.code",
      "position": [
        1568,
        112
      ]
    },
    {
      "id": "53b6ef38-ad3c-4b50-ac40-e04e5503479a",
      "name": "Prepare Image Data URL",
      "type": "n8n-nodes-base.code",
      "position": [
        1328,
        272
      ]
    },
    {
      "id": "79133794-159c-4987-87bb-80c0821922a5",
      "name": "Build Image Payload",
      "type": "n8n-nodes-base.code",
      "position": [
        1568,
        272
      ]
    },
    {
      "id": "d5e49e77-6f5a-4421-875d-0e249be73d27",
      "name": "Analyze Image with NVIDIA",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1824,
        272
      ]
    },
    {
      "id": "5516a7f4-c51c-462d-9a4d-f51bf226e06e",
      "name": "Normalize Image",
      "type": "n8n-nodes-base.code",
      "position": [
        2096,
        272
      ]
    },
    {
      "id": "75db9680-186f-4594-bda3-a5928b19101b",
      "name": "Extract from Text File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1328,
        592
      ]
    },
    {
      "id": "42b50c4a-2811-4722-a166-d3d9d807e1c6",
      "name": "Normalize Text File",
      "type": "n8n-nodes-base.code",
      "position": [
        1568,
        592
      ]
    },
    {
      "id": "ca006ec2-196b-4611-811c-7c6389526cab",
      "name": "Extract from CSV",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1328,
        752
      ]
    },
    {
      "id": "ad4d4750-c19a-40ab-92d9-c68b48a6d60b",
      "name": "Normalize CSV",
      "type": "n8n-nodes-base.code",
      "position": [
        1568,
        752
      ]
    },
    {
      "id": "f54a8128-9e91-4d2d-b4bf-aed3f7ed5613",
      "name": "Normalize Raw Text",
      "type": "n8n-nodes-base.code",
      "position": [
        832,
        912
      ]
    },
    {
      "id": "105c960a-a06c-43bb-bb85-3944fac89225",
      "name": "Send Unsupported Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        832,
        1088
      ]
    },
    {
      "id": "c727e5de-c8ba-4d1c-9ee8-1be0794719ae",
      "name": "Build Structuring Payload",
      "type": "n8n-nodes-base.code",
      "position": [
        1904,
        432
      ]
    },
    {
      "id": "9aa50389-31c1-467a-b494-9739001b3b12",
      "name": "Structure Output with NVIDIA",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2208,
        432
      ]
    },
    {
      "id": "9ae98693-24ea-4bee-8cfc-7f47a174f299",
      "name": "Parse Structured Output",
      "type": "n8n-nodes-base.code",
      "position": [
        2464,
        432
      ]
    },
    {
      "id": "c9c31b49-b926-46a8-a258-513b99098928",
      "name": "Append Row in Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2768,
        336
      ]
    },
    {
      "id": "20cbfebd-8602-40f4-8b79-307a7f9d9dbd",
      "name": "Build Telegram Reply",
      "type": "n8n-nodes-base.code",
      "position": [
        2768,
        528
      ]
    },
    {
      "id": "e447d8ab-4e99-4e47-8add-5a6ae9003a55",
      "name": "Send Reply",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2992,
        528
      ]
    },
    {
      "id": "a714101a-c2c2-4ab8-a231-f7d7231217c5",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        640
      ],
      "parameters": {
        "width": 608,
        "height": 336,
        "content": "## Step 2 — Credentials\n\nCreate and connect these credentials before testing:\n\n- Google Drive OAuth2 account — used by `Google Drive Trigger` and `Download Drive File`\n- Google Docs OAuth2 account — u"
      }
    },
    {
      "id": "44bc95df-dcdc-404a-8ac6-08172e47e46e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2720,
        800
      ],
      "parameters": {
        "width": 512,
        "height": 448,
        "content": "## Step 4 — Activate\n\nBefore activating the workflow, test one file at a time in this order:\n\n- PDF\n- text file\n- CSV\n- image\n- Google Doc\n\nFor each test, confirm:\n- the correct branch ran\n- extracted"
      }
    }
  ],
  "connections": {
    "Route Input": {
      "main": [
        [
          {
            "node": "Download Drive File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download Drive File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Google Doc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download Drive File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download Drive File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Unsupported Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize CSV": {
      "main": [
        [
          {
            "node": "Build Structuring Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize PDF": {
      "main": [
        [
          {
            "node": "Build Structuring Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Google Doc": {
      "main": [
        [
          {
            "node": "Normalize Google Doc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Image": {
      "main": [
        [
          {
            "node": "Build Structuring Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Input": {
      "main": [
        [
          {
            "node": "Route Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from CSV": {
      "main": [
        [
          {
            "node": "Normalize CSV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from PDF": {
      "main": [
        [
          {
            "node": "Normalize PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Raw Text": {
      "main": [
        [
          {
            "node": "Build Structuring Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Image Payload": {
      "main": [
        [
          {
            "node": "Analyze Image with NVIDIA",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Drive File": {
      "main": [
        [
          {
            "node": "Route Downloaded File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Text File": {
      "main": [
        [
          {
            "node": "Build Structuring Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Telegram Reply": {
      "main": [
        [
          {
            "node": "Send Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Normalize Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Google Doc": {
      "main": [
        [
          {
            "node": "Build Structuring Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Downloaded File": {
      "main": [
        [
          {
            "node": "Extract from PDF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare Image Data URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract from Text File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract from CSV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from Text File": {
      "main": [
        [
          {
            "node": "Normalize Text File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Image Data URL": {
      "main": [
        [
          {
            "node": "Build Image Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Structured Output": {
      "main": [
        [
          {
            "node": "Append Row in Sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Build Telegram Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Image with NVIDIA": {
      "main": [
        [
          {
            "node": "Normalize Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Structuring Payload": {
      "main": [
        [
          {
            "node": "Structure Output with NVIDIA",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structure Output with NVIDIA": {
      "main": [
        [
          {
            "node": "Parse Structured Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}