{
  "name": "Parse PDF, DOCX & images with Mistral OCR via Google Drive with Slack alerts",
  "nodes": [
    {
      "id": "beeb0f7f-e489-4955-b87a-702ca909628a",
      "name": "File Created",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -1792,
        -272
      ]
    },
    {
      "id": "70baab34-54e4-4933-8093-b28d34090c3e",
      "name": "File Updated",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -1792,
        -80
      ]
    },
    {
      "id": "59f4249a-2445-488e-9a5c-78718506d9f9",
      "name": "Set File ID",
      "type": "n8n-nodes-base.set",
      "position": [
        -1296,
        -160
      ]
    },
    {
      "id": "9d4db769-a867-4938-b513-c5402f007e4d",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        2208,
        208
      ]
    },
    {
      "id": "4521d9c9-2040-4181-b298-2ad0640d0002",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        2640,
        -16
      ]
    },
    {
      "id": "9ed3238e-d415-43f7-b452-9806479b7de9",
      "name": "Save Image",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2400,
        208
      ]
    },
    {
      "id": "fc0c520a-6650-4952-a161-5fe389ff9dfa",
      "name": "Split Images",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1808,
        208
      ]
    },
    {
      "id": "c5851dc0-b183-46a6-82b9-b8cbf3907248",
      "name": "Split Pages",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1472,
        0
      ]
    },
    {
      "id": "2976c696-75ba-4876-b378-f4db44782da6",
      "name": "OCR Document",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1216,
        -208
      ]
    },
    {
      "id": "82a0d06b-50e1-4427-a459-45a59ed0ff1c",
      "name": "Download File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1024,
        -208
      ]
    },
    {
      "id": "d6d25c96-67a3-4ae3-873f-2cd54fabb366",
      "name": "Create Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -576,
        -176
      ]
    },
    {
      "id": "c2119a4c-7b3b-465e-9437-12ff585f6bd6",
      "name": "Copy file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -208,
        -176
      ]
    },
    {
      "id": "1f4180a9-333a-421c-aea6-0f9666ce55ed",
      "name": "Save Page MD File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1808,
        0
      ]
    },
    {
      "id": "45fe0471-0558-49a4-afd9-a63e42ca198f",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        2000,
        -176
      ]
    },
    {
      "id": "0dac4cc0-5506-4690-bd13-c0e4d4bfb91f",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1808,
        -176
      ]
    },
    {
      "id": "856f5947-55d6-42c7-91bf-d98f82440094",
      "name": "Save MD File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2208,
        -176
      ]
    },
    {
      "id": "c52e230e-1185-4461-a6f5-26204ec481be",
      "name": "Save raw OCR file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1472,
        -320
      ]
    },
    {
      "id": "1cda08ff-f68a-40e6-b0cd-89d7d9f60847",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        2864,
        -160
      ]
    },
    {
      "id": "2dc3cd63-1430-42ca-a475-caf7e2138b23",
      "name": "Add MD file in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2400,
        -176
      ]
    },
    {
      "id": "aee9f683-30ea-4817-a51a-1d6884a630d4",
      "name": "Add json file in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2640,
        -320
      ]
    },
    {
      "id": "28756c24-c8ca-4a91-8d98-e4c3bc30a8b3",
      "name": "Create Entry in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -384,
        -176
      ]
    },
    {
      "id": "cb5b2286-ab97-4021-a674-b3ee1289b7f4",
      "name": "Complete job in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3072,
        -160
      ]
    },
    {
      "id": "e2696f2f-5442-444e-873e-fc40e7b742bb",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        -528
      ],
      "parameters": {
        "width": 2112,
        "height": 1020,
        "content": "## 4. Upload to Google Drive\n[Read more about Slack OAuth2 credentials](https://docs.n8n.io/integrations/builtin/credentials/slack/#using-oauth2)\n\n\n**📄 MD Files:** \n  * An MD file per page is created."
      }
    },
    {
      "id": "ac3a9ab0-4a5f-4f4d-a882-3c2fdeac3b72",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -528
      ],
      "parameters": {
        "width": 1168,
        "height": 1020,
        "content": "## 3. Perform OCR Using Mistral Document\n[Read more about Mistral Document ](https://docs.mistral.ai/capabilities/document_ai/basic_ocr/)\n[Read more about Mistral Cloud Credentials](https://docs.n8n.i"
      }
    },
    {
      "id": "440b897e-5a82-45a5-888b-051616e617cc",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -528
      ],
      "parameters": {
        "width": 728,
        "height": 1020,
        "content": "## 2. Copy File to Target Directory\n\n* Create a destination directory and copy the source file into it.\n* Add a row to the Google Sheet to track progress. The row identifier is the unique URL of the d"
      }
    },
    {
      "id": "a05f0d84-d6dd-4826-b887-919edb13d1c6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1888,
        -528
      ],
      "parameters": {
        "width": 728,
        "height": 1020,
        "content": "## 1. Watch for New and Updated Files in Google Drive Folder\n\n[Read more about the Google Drive Trigger node](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.googledrivetrigger/)"
      }
    },
    {
      "id": "41536036-583f-4823-bafe-67d1bac4715a",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        -528
      ],
      "parameters": {
        "width": 432,
        "height": 464,
        "content": "## ⚙️ Update the Workflow Configuration Node\n\n- `google_sheet_id`: Set this to the ID of your Google Sheet. See **Google Sheets Configuration** for the sheet name and column details.\n- `dest_folder_id"
      }
    },
    {
      "id": "a8ed6e6e-6cc7-420a-8be9-f22d1309f55d",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -928,
        -272
      ]
    },
    {
      "id": "fa6c28ed-ddf0-4616-879d-7ec9bf420a5a",
      "name": "Extract Base64 value",
      "type": "n8n-nodes-base.set",
      "position": [
        2016,
        208
      ]
    },
    {
      "id": "b1481ea4-501f-492a-9937-ed686d1ac0b1",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        -16
      ],
      "parameters": {
        "width": 432,
        "height": 512,
        "content": "## 🔒 Setup credentials\n- `Slack` node: Configure authentication in the Slack node. [Read more about Slack credentials](https://docs.n8n.io/integrations/builtin/credentials/slack/)\n- `OCR Document` nod"
      }
    },
    {
      "id": "db701dbb-6259-4b8c-9d6d-ddb556dbebd8",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -16
      ],
      "parameters": {
        "width": 528,
        "height": 496,
        "content": "## 📊 Google Sheets Configuration\n\n**Required Sheet Name:** `\"Files\"`  \nThe spreadsheet can have any name and contain any number of sheets. However, it must include a sheet named `Files`.\n\n**Required H"
      }
    },
    {
      "id": "ee6c21e6-f369-4575-88dc-7513b6531e4a",
      "name": "Use Document Url",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        -208
      ]
    },
    {
      "id": "d019b653-d7e8-4795-9741-a350c98068d4",
      "name": "Use Image Url",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        -48
      ]
    },
    {
      "id": "bb211334-f05d-4d96-ac23-33c5fead8c57",
      "name": "Determine Document Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        208,
        -192
      ]
    },
    {
      "id": "a59769d9-b68b-4492-93b0-453db7e717b1",
      "name": "Add Source File in Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -32,
        -176
      ]
    },
    {
      "id": "e34491fc-b2e2-4356-a37f-aac18d0a7ff6",
      "name": "Set Error in Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        480,
        112
      ]
    },
    {
      "id": "7c803662-2051-414c-8bc4-9495b4d8034f",
      "name": "Send Success  Message",
      "type": "n8n-nodes-base.slack",
      "position": [
        3280,
        288
      ]
    },
    {
      "id": "53c9dbc7-1b0f-4fc5-8cec-032b79393413",
      "name": "Send Error Message",
      "type": "n8n-nodes-base.slack",
      "position": [
        720,
        288
      ]
    },
    {
      "id": "b37f2994-8114-4776-a9ad-c9a48ead4397",
      "name": "Use Url",
      "type": "n8n-nodes-base.set",
      "position": [
        784,
        -208
      ]
    },
    {
      "id": "4ee78018-6234-428f-a353-1f3c4ee2ab04",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2976,
        -640
      ],
      "parameters": {
        "width": 1036,
        "height": 1216,
        "content": "## Automated OCR for PDFs, DOCX & images via Google Drive & Mistral\n\n### Use cases \n* Monitor Google Drive folder, parsing PDF, DOCX and image file into a destination folder, ready for further process"
      }
    },
    {
      "id": "e1fa4d46-e61b-48ac-8fea-dda6daadba9e",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1840,
        80
      ],
      "parameters": {
        "width": 656,
        "height": 384,
        "content": "## ⚙️ Configuration\n\n* **`File Created` and `File Updated` nodes**:  \n  Update the `Folder` field in both Google Drive nodes to point to the ID of the folder you want to monitor. You can also set the "
      }
    },
    {
      "id": "f751279b-aaaf-4237-a7dd-4f767ba04811",
      "name": "Loop over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1568,
        -176
      ]
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Complete job in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Use Url": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Copy file": {
      "main": [
        [
          {
            "node": "Add Source File in Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Image": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Set File ID": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Pages": {
      "main": [
        [
          {
            "node": "Split Images",
            "type": "main",
            "index": 0
          },
          {
            "node": "Save Page MD File",
            "type": "main",
            "index": 0
          },
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File Created": {
      "main": [
        [
          {
            "node": "Loop over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File Updated": {
      "main": [
        [
          {
            "node": "Loop over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OCR Document": {
      "main": [
        [
          {
            "node": "Save raw OCR file",
            "type": "main",
            "index": 0
          },
          {
            "node": "Split Pages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save MD File": {
      "main": [
        [
          {
            "node": "Add MD file in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Images": {
      "main": [
        [
          {
            "node": "Extract Base64 value",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Folder": {
      "main": [
        [
          {
            "node": "Create Entry in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "OCR Document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Use Image Url": {
      "main": [
        [
          {
            "node": "Use Url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Save Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop over Items": {
      "main": [
        [],
        [
          {
            "node": "Set File ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Use Document Url": {
      "main": [
        [
          {
            "node": "Use Url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Page MD File": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Save raw OCR file": {
      "main": [
        [
          {
            "node": "Add json file in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Save MD File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Error Message": {
      "main": [
        [
          {
            "node": "Loop over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Error in Sheet": {
      "main": [
        [
          {
            "node": "Send Error Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add MD file in sheet": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Base64 value": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Complete job in sheet": {
      "main": [
        [
          {
            "node": "Send Success  Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Entry in sheet": {
      "main": [
        [
          {
            "node": "Copy file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Success  Message": {
      "main": [
        [
          {
            "node": "Loop over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add json file in sheet": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Create Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Determine Document Type": {
      "main": [
        [
          {
            "node": "Use Document Url",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Use Image Url",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set Error in Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Source File in Sheet": {
      "main": [
        [
          {
            "node": "Determine Document Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}