{
  "id": "R82cCEu45d5np7SQ",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "tags": [],
  "nodes": [
    {
      "id": "beeb0f7f-e489-4955-b87a-702ca909628a",
      "name": "File Created",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -1792,
        -272
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {
          "fileType": "all"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "unit": "minutes",
              "value": 5
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "id",
          "value": ""
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "70baab34-54e4-4933-8093-b28d34090c3e",
      "name": "File Updated",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -1792,
        -80
      ],
      "parameters": {
        "event": "fileUpdated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "unit": "minutes",
              "value": 5
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "id",
          "value": ""
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "59f4249a-2445-488e-9a5c-78718506d9f9",
      "name": "Set File ID",
      "type": "n8n-nodes-base.set",
      "position": [
        -1296,
        -160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "500b4c9d-617a-4d88-9d74-9beb5922a00a",
              "name": "file_id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "d5779b2e-12fd-4a73-9181-da4b9eec5b67",
              "name": "file_name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "3349c2ff-89a4-4b95-93b3-52c4d5316127",
              "name": "dest_folder",
              "type": "string",
              "value": "={{ $json.name.split('.').slice(0, -1).join('.'); }}"
            },
            {
              "id": "f79e2578-3375-4e1d-88e0-748e2daac35b",
              "name": "file_name_no_ext",
              "type": "string",
              "value": "={{ $json.name.split('.').slice(0, -1).join('.'); }}"
            },
            {
              "id": "45b4ffe8-1ebc-48f8-8234-c497c4081f39",
              "name": "mime_type",
              "type": "string",
              "value": "={{ $json.mimeType }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9d4db769-a867-4938-b513-c5402f007e4d",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        2208,
        208
      ],
      "parameters": {
        "options": {
          "fileName": "={{ $json.id }}",
          "mimeType": "={{ $json.image_base64.split(';')[0].split(':').pop() }}"
        },
        "operation": "toBinary",
        "sourceProperty": "stripped_image_base64",
        "binaryPropertyName": "=image"
      },
      "typeVersion": 1.1
    },
    {
      "id": "4521d9c9-2040-4181-b298-2ad0640d0002",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        2640,
        -16
      ],
      "parameters": {
        "mode": "chooseBranch",
        "numberInputs": 3
      },
      "typeVersion": 3.2
    },
    {
      "id": "9ed3238e-d415-43f7-b452-9806479b7de9",
      "name": "Save Image",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2400,
        208
      ],
      "parameters": {
        "name": "={{ $binary.data.fileName }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create Folder').item.json.id }}"
        },
        "inputDataFieldName": "=image"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "fc0c520a-6650-4952-a161-5fe389ff9dfa",
      "name": "Split Images",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1808,
        208
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "images"
      },
      "typeVersion": 1
    },
    {
      "id": "c5851dc0-b183-46a6-82b9-b8cbf3907248",
      "name": "Split Pages",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1472,
        0
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "body.pages"
      },
      "typeVersion": 1
    },
    {
      "id": "2976c696-75ba-4876-b378-f4db44782da6",
      "name": "OCR Document",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1216,
        -208
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/ocr",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "json"
            }
          }
        },
        "jsonBody": "={\n  \"model\": \"mistral-ocr-latest\",\n  \"document\": {\n    \"type\": \"{{ $('Use Url').item.json.document_type }}\",\n    \"{{ $('Use Url').item.json.document_type }}\": \"data:{{ $('Set File ID').item.json.mime_type }};base64,{{ $('Download File').item.binary.binary_file_data.data }}\"\n  },\n  \"include_image_base64\": true\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "82a0d06b-50e1-4427-a459-45a59ed0ff1c",
      "name": "Download File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1024,
        -208
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Copy file').item.json.id }}"
        },
        "options": {
          "binaryPropertyName": "binary_file_data"
        },
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "d6d25c96-67a3-4ae3-873f-2cd54fabb366",
      "name": "Create Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -576,
        -176
      ],
      "parameters": {
        "name": "={{ $('Set File ID').item.json.dest_folder }}_{{ $now.format('yyyyMMdd-hhmmss') }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').item.json.dest_folder_id }}"
        },
        "resource": "folder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "c2119a4c-7b3b-465e-9437-12ff585f6bd6",
      "name": "Copy file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -208,
        -176
      ],
      "parameters": {
        "name": "={{ $('Set File ID').item.json.file_name }}",
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set File ID').item.json.file_id }}"
        },
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create Folder').item.json.id }}"
        },
        "operation": "copy",
        "sameFolder": false
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "1f4180a9-333a-421c-aea6-0f9666ce55ed",
      "name": "Save Page MD File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1808,
        0
      ],
      "parameters": {
        "name": "={{ $('Set File ID').item.json.file_name_no_ext }}_page_{{ String($json.index + 1).padStart($('OCR Document').item.json.body.pages.length.toString().length, '0') }}.md",
        "content": "={{ $json.markdown }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create Folder').item.json.id }}"
        },
        "operation": "createFromText"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "45fe0471-0558-49a4-afd9-a63e42ca198f",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        2000,
        -176
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "return { markdown: $json.full_markdown.join('\\n\\n') };"
      },
      "typeVersion": 2
    },
    {
      "id": "0dac4cc0-5506-4690-bd13-c0e4d4bfb91f",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1808,
        -176
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "renameField": true,
              "outputFieldName": "full_markdown",
              "fieldToAggregate": "markdown"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "856f5947-55d6-42c7-91bf-d98f82440094",
      "name": "Save MD File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2208,
        -176
      ],
      "parameters": {
        "name": "={{ $('Set File ID').item.json.file_name_no_ext }}.md",
        "content": "={{ $json.markdown }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create Folder').item.json.id }}"
        },
        "operation": "createFromText"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "c52e230e-1185-4461-a6f5-26204ec481be",
      "name": "Save raw OCR file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1472,
        -320
      ],
      "parameters": {
        "name": "={{ $('Set File ID').item.json.file_name_no_ext }}.json",
        "content": "={{ JSON.stringify($json.body, null, 2) }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create Folder').item.json.id }}"
        },
        "operation": "createFromText"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "1cda08ff-f68a-40e6-b0cd-89d7d9f60847",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        2864,
        -160
      ],
      "parameters": {
        "mode": "chooseBranch",
        "output": "empty"
      },
      "typeVersion": 3.2
    },
    {
      "id": "2dc3cd63-1430-42ca-a475-caf7e2138b23",
      "name": "Add MD file in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2400,
        -176
      ],
      "parameters": {
        "columns": {
          "value": {
            "MD File": "=https://drive.google.com/file/d/{{ $json.id }}",
            "Directory": "=https://drive.google.com/drive/folders/{{ $('Create Folder').item.json.id }}"
          },
          "schema": [
            {
              "id": "File Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "File Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "File",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Directory",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Directory",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "JSON file",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "JSON file",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "MD File",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "MD File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Started",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Started",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Completed",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Completed",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Directory"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mN6Pszfd3D0Vora4Kl8JHJQxuaZ7rD_Zbs0p2wyfnZw/edit#gid=0",
          "cachedResultName": "Files"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').item.json.google_sheet_id }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "aee9f683-30ea-4817-a51a-1d6884a630d4",
      "name": "Add json file in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2640,
        -320
      ],
      "parameters": {
        "columns": {
          "value": {
            "Directory": "=https://drive.google.com/drive/folders/{{ $('Create Folder').item.json.id }}",
            "JSON file": "=https://drive.google.com/file/d/{{ $json.id }}"
          },
          "schema": [
            {
              "id": "File Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "File Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "File",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Directory",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Directory",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "JSON file",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "JSON file",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "MD File",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "MD File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Started",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Started",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Completed",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Completed",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Directory"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mN6Pszfd3D0Vora4Kl8JHJQxuaZ7rD_Zbs0p2wyfnZw/edit#gid=0",
          "cachedResultName": "Files"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').item.json.google_sheet_id }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "28756c24-c8ca-4a91-8d98-e4c3bc30a8b3",
      "name": "Create Entry in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -384,
        -176
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Started",
            "Started": "={{ $now.format('yyyy-MM-dd hh:mm:ss') }}",
            "Directory": "=https://drive.google.com/drive/folders/{{ $('Create Folder').item.json.id }}",
            "File Name": "={{ $('Set File ID').item.json.file_name }}"
          },
          "schema": [
            {
              "id": "File Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "File Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "File",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Directory",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Directory",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "JSON file",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "JSON file",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "MD File",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "MD File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Started",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Started",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Completed",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Completed",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Directory"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mN6Pszfd3D0Vora4Kl8JHJQxuaZ7rD_Zbs0p2wyfnZw/edit#gid=0",
          "cachedResultName": "Files"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').item.json.google_sheet_id }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "cb5b2286-ab97-4021-a674-b3ee1289b7f4",
      "name": "Complete job in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3072,
        -160
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Done",
            "Completed": "={{ $now.format('yyyy-MM-dd hh:mm:ss') }}",
            "Directory": "=https://drive.google.com/drive/folders/{{ $('Create Folder').item.json.id }}"
          },
          "schema": [
            {
              "id": "File Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "File Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "File",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Directory",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Directory",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "JSON file",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "JSON file",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "MD File",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "MD File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Started",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Started",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Completed",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Completed",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Directory"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mN6Pszfd3D0Vora4Kl8JHJQxuaZ7rD_Zbs0p2wyfnZw/edit#gid=0",
          "cachedResultName": "Files"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').item.json.google_sheet_id }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e2696f2f-5442-444e-873e-fc40e7b742bb",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        -528
      ],
      "parameters": {
        "color": 7,
        "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**\ud83d\udcc4 MD Files:** \n  * An MD file per page is created. This is helpful for validating OCR accuracy. \n  * An aggregate file with the entire content is created for further processing.\n \n**\ud83d\udcca Images:** Images are Base64 strings with a Mime Type headers. Header is stripped and Base64 string is converted to binary before saving to Google Drive. "
      },
      "typeVersion": 1
    },
    {
      "id": "ac3a9ab0-4a5f-4f4d-a882-3c2fdeac3b72",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -528
      ],
      "parameters": {
        "color": 7,
        "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.io/integrations/builtin/credentials/mistral/)\n[Read more about Slack OAuth2 credentials](https://docs.n8n.io/integrations/builtin/credentials/slack/#using-oauth2)\n\n* Validate the file Mime Type and exit if type is unsupported.\n  * **Note:** Configure the Switch node to add more file types supported by Mistral Document. This workflow currently supports `pdf`, `docx`, `png`, `jpg`, and `jpeg`.\n* Download the file into n8n and pass it as a Base64-encoded document in the body of the POST request.  \n  * **Implementation Note:** Alternatively, you can upload the file to Mistral and provide a signed URL to Mistral Document.\n* Parse the document using Mistral Document.  \n  * **Implementation Note:** The Mistral AI Extract Text node cannot be used here, as it does not return images in the response. The Mistral API must be called directly instead.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "440b897e-5a82-45a5-888b-051616e617cc",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -528
      ],
      "parameters": {
        "color": 7,
        "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 destination directory.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a05f0d84-d6dd-4826-b887-919edb13d1c6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1888,
        -528
      ],
      "parameters": {
        "color": 7,
        "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/)\n[Read more about Google Credentials](https://docs.n8n.io/integrations/builtin/credentials/google/)\n\nOther sources like local file system, OneDrive, S3 can be used instead.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "41536036-583f-4823-bafe-67d1bac4715a",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        -528
      ],
      "parameters": {
        "color": 4,
        "width": 432,
        "height": 464,
        "content": "## \u2699\ufe0f 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`: Set this to the ID of the folder that will contain all output files.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a8ed6e6e-6cc7-420a-8be9-f22d1309f55d",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -928,
        -272
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c16e829e-d2f6-49e0-9ffe-ee0c4fca0487",
              "name": "google_sheet_id",
              "type": "string",
              "value": ""
            },
            {
              "id": "4c4d3dc8-d102-40dc-9943-7de13cb2324a",
              "name": "dest_folder_id",
              "type": "string",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fa6c28ed-ddf0-4616-879d-7ec9bf420a5a",
      "name": "Extract Base64 value",
      "type": "n8n-nodes-base.set",
      "position": [
        2016,
        208
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6a29a531-c96a-4c0e-b867-343ab08e884e",
              "name": "stripped_image_base64",
              "type": "string",
              "value": "={{ $json.image_base64.split(',').pop() }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "b1481ea4-501f-492a-9937-ed686d1ac0b1",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        -16
      ],
      "parameters": {
        "color": 4,
        "width": 432,
        "height": 512,
        "content": "## \ud83d\udd12 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` node: Configure authentication in the node using your Mistral AI API key [Read more about Mistral credentials](https://docs.n8n.io/integrations/builtin/credentials/mistral/)\n- All `Google` nodes: Configure authentication in all the Google nodes (Drive and Sheet). [Read more about Google credentials](https://docs.n8n.io/integrations/builtin/credentials/google/)\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "db701dbb-6259-4b8c-9d6d-ddb556dbebd8",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -16
      ],
      "parameters": {
        "color": 6,
        "width": 528,
        "height": 496,
        "content": "## \ud83d\udcca 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 Headers (Row 1):**\n- **File Name** \u2013 Name of the input file\n- **File** \u2013 Link to the input file (copy)\n- **Directory** \u2013 Link to the output directory\n- **JSON File** \u2013 Link to the OCR JSON file\n- **MD File** \u2013 Link to the OCR Markdown file\n- **Started** \u2013 Timestamp when the job started\n- **Completed** \u2013 Timestamp when the job completed\n- **Status** \u2013 Job status (`Started`, `Done`, `Unsupported Type`)\n\n**\ud83d\udd17 Account Permissions**  \nThe signed-in account must have **Editor** access to the Google Sheet.\n\n**\u2699\ufe0f Setup**  \nThe Google Sheet ID is set in the `Workflow Configuration` step."
      },
      "typeVersion": 1
    },
    {
      "id": "ee6c21e6-f369-4575-88dc-7513b6531e4a",
      "name": "Use Document Url",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        -208
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f229d051-0ac2-4aed-9e6f-6315270a9dad",
              "name": "document_type",
              "type": "string",
              "value": "document_url"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "d019b653-d7e8-4795-9741-a350c98068d4",
      "name": "Use Image Url",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        -48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f229d051-0ac2-4aed-9e6f-6315270a9dad",
              "name": "document_type",
              "type": "string",
              "value": "image_url"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "bb211334-f05d-4d96-ac23-33c5fead8c57",
      "name": "Determine Document Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        208,
        -192
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "6bba9a77-2985-44f3-a746-2431ec9ed3d6",
                    "operator": {
                      "type": "string",
                      "operation": "regex"
                    },
                    "leftValue": "={{ $('Set File ID').item.json.mime_type }}",
                    "rightValue": "^(application\\/pdf|application\\/vnd\\.openxmlformats\\-officedocument\\.wordprocessingml\\.document)$"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "3fbb7b81-6b50-4ba9-8c73-0def8f8d4ab6",
                    "operator": {
                      "type": "string",
                      "operation": "regex"
                    },
                    "leftValue": "={{ $('Set File ID').item.json.mime_type }}",
                    "rightValue": "^image\\/(png|jpeg|jpg)$"
                  }
                ]
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "a59769d9-b68b-4492-93b0-453db7e717b1",
      "name": "Add Source File in Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -32,
        -176
      ],
      "parameters": {
        "columns": {
          "value": {
            "File": "=https://drive.google.com/file/d/{{ $json.id }}",
            "Directory": "=https://drive.google.com/drive/folders/{{ $('Create Folder').item.json.id }}"
          },
          "schema": [
            {
              "id": "File Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "File Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "File",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Directory",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Directory",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "JSON file",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "JSON file",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "MD File",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "MD File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Started",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Started",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Completed",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Completed",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Directory"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mN6Pszfd3D0Vora4Kl8JHJQxuaZ7rD_Zbs0p2wyfnZw/edit#gid=0",
          "cachedResultName": "Files"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').item.json.google_sheet_id }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e34491fc-b2e2-4356-a37f-aac18d0a7ff6",
      "name": "Set Error in Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        480,
        112
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Unsupported Type",
            "Completed": "={{ $now.format('yyyy-MM-dd hh:mm:ss') }}",
            "Directory": "=https://drive.google.com/drive/folders/{{ $('Create Folder').item.json.id }}"
          },
          "schema": [
            {
              "id": "File Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "File Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "File",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Directory",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Directory",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "JSON file",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "JSON file",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "MD File",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "MD File",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Started",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Started",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Completed",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Completed",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Directory"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mN6Pszfd3D0Vora4Kl8JHJQxuaZ7rD_Zbs0p2wyfnZw/edit#gid=0",
          "cachedResultName": "Files"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').item.json.google_sheet_id }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "7c803662-2051-414c-8bc4-9495b4d8034f",
      "name": "Send Success  Message",
      "type": "n8n-nodes-base.slack",
      "position": [
        3280,
        288
      ],
      "parameters": {
        "text": "=\u2705 File <https://drive.google.com/file/d/{{ $('Copy file').item.json.id }}|{{ $('Set File ID').item.json.file_name }}> processed.\n\ud83d\udcc2 Results are available <https://drive.google.com/drive/folders/{{ $('Create Folder').item.json.id }}|here>.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C0462450N",
          "cachedResultName": "general"
        },
        "otherOptions": {
          "mrkdwn": true
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "53c9dbc7-1b0f-4fc5-8cec-032b79393413",
      "name": "Send Error Message",
      "type": "n8n-nodes-base.slack",
      "position": [
        720,
        288
      ],
      "parameters": {
        "text": "=\u26d4 File <https://drive.google.com/file/d/{{ $('Copy file').item.json.id }}|{{ $('Set File ID').item.json.file_name }}> not processed.\nReason: File type is not supported.\n\ud83d\udcc2 Results are available <https://drive.google.com/drive/folders/{{ $('Create Folder').item.json.id }}|here>.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C0462450N",
          "cachedResultName": "general"
        },
        "otherOptions": {
          "mrkdwn": true
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "b37f2994-8114-4776-a9ad-c9a48ead4397",
      "name": "Use Url",
      "type": "n8n-nodes-base.set",
      "position": [
        784,
        -208
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e5f7685c-237a-4338-b19a-354d53125129",
              "name": "document_type",
              "type": "string",
              "value": "={{ $json.document_type }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "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 processing (e.g. RAG ingestion, translation, etc.)\n* Keep processing log in Google Sheet and send Slack notifications. \n\n### How it works\n* Trigger: Watch Google Drive folder for new and updated files.\n* Create a uniquely named destination folder, copying the input file.\n* Parse the file using Mistral Document, extracting content and handling non-OCRable images separately.\n* Save the data returned by Mistral Document into the destination Google Drive folder (raw JSON file, Markdown files, and images) for further processing.\n\n\n### How to use\n* Google Drive and Google Sheets nodes:\n  * Create Google credentials with access to Google Drive and Google Sheets. [Read more about Google Credentials](https://docs.n8n.io/integrations/builtin/credentials/google/).\n  * Update **all** Google Drive and Google Sheets nodes (14 nodes total) to use the credentials\n* Mistral node:\n  * Create Mistral Cloud API credentials. [Read more about Mistral Cloud Credentials](https://docs.n8n.io/integrations/builtin/credentials/mistral/).\n  * Update the `OCR Document` node to use the Mistral Cloud credentials.\n* Slack nodes:\n  * Create Slack OAuth2 credentials. [Read more about Slack OAuth2 credentials](https://docs.n8n.io/integrations/builtin/credentials/slack/#using-oauth2)\n   * Update the two Slack nodes: `Send Success  Message` and `Send Error Message`:\n      * Set the credentials\n      * Select the channel where you want to send the notifications (channels can be different for success and errors). \n* Create a Google Sheets spreadsheet following the steps in `Google Sheets Configuration` (see right \u27a1\ufe0f). Ensure the spreadsheet can be accessed as `Editor` by the account used by the Google Credentials above.\n* Create a directory for input files and a directory for output folders/files. Ensure the directories can be accessed by the account used by the Google Credentials.\n* Update the `File Created`, `File Updated` and `Workflow Configuration` node following the steps in the green Notes (see right \u27a1\ufe0f).\n\n\n### Requirements\n* Google account with Google API access\n* Mistral Cloud account access to Mistral API key.\n* Slack account with access to Slack client ID and secret ID. \n* Basic n8n knowledge: understanding of triggers, expressions, and credential management\n\n\n### Who\u2019s it for\nAnyone building a data pipeline ingesting files to be OCRed for further processing. \n\n\n### \ud83d\udd12 Security\nAll credentials are stored as n8n credentials. The only information stored in this workflow that *could* be considered sensitive are the Google Drive Directory and Sheet IDs. These directories and the spreadsheet should be secured according to your needs.\n\n\n### Need Help?\nReach out on [LinkedIn](https://www.linkedin.com/in/ytkaczyk/) or Ask in the [Forum](https://community.n8n.io/)!\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e1fa4d46-e61b-48ac-8fea-dda6daadba9e",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1840,
        80
      ],
      "parameters": {
        "color": 4,
        "width": 656,
        "height": 384,
        "content": "## \u2699\ufe0f 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 folder by URL or select it from a list.\n\n### \u2754 How to Get the ID of a Sheet or Directory \u2754\n\nOpen the sheet or directory in your browser. The ID is the randomly generated alphanumeric string in the URL.\n\n* **For a directory**: The ID appears after the last `/` in the URL and looks like `abcdefghijklmnopqr_abcdefghijklmn`\n* **For a sheet**: The ID is located in the middle of the URL and looks like `abcdefghijklmnopqrstuvwxyzABCDE_abcdefghijkl`\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f751279b-aaaf-4237-a7dd-4f767ba04811",
      "name": "Loop over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1568,
        -176
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    }
  ],
  "active": false,
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1",
    "timeSavedPerExecution": 5
  },
  "versionId": "9bcb21b1-2f19-4cee-b3c5-9bc580a3e72f",
  "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
          }
        ]
      ]
    }
  }
}