{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "2bc75899-e75c-4b28-a82c-ef48f3a9f931",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -448,
        320
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "cdd69ab2-8f3c-4332-9191-f7a8699a8b72",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        448,
        320
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "69266cd8-3c7e-4fe1-940a-c10f89b55bf1",
      "name": "Global Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b11783c7-ab99-4cf7-b4cb-fb05d0d7b1a3",
              "name": "page",
              "type": "string",
              "value": "Draft 5"
            },
            {
              "id": "d5758aa9-7590-4d5d-ad8c-b57c4aec889f",
              "name": "Description",
              "type": "string",
              "value": "={{ $json.Description }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d7390c88-d913-4ef7-a5c4-84a501ef6af5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        144
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 400,
        "content": "## Define and Get Script\nHere you set the name of the page where your script is, and it gets that page information. The set variable is used so the page can be queried later when the video link is embedded in the sheet. "
      },
      "typeVersion": 1
    },
    {
      "id": "73408c21-5c1b-4de6-b26e-deb81f9e0099",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        144
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 400,
        "content": "## Get Avatar description\nThis section gets the description of the Avatar"
      },
      "typeVersion": 1
    },
    {
      "id": "846bc24f-dc21-457e-9b36-b2c2257a8600",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 1328,
        "height": 688,
        "content": "![gemini](https://upload.wikimedia.org/wikipedia/commons/thumb/8/8a/Google_Gemini_logo.svg/330px-Google_Gemini_logo.svg.png)\n\n## Generate Snippet Videos\nThis section handles the full video-generation loop. For each row in the script sheet, the workflow sends the avatar description, framing, and speech text to the Gemini Veo model to generate an individual video snippet.\n\nOnce the video is created, it is uploaded directly to the designated Google Drive folder. After the upload, the workflow writes the generated file\u2019s shareable link back into the corresponding row of the sheet. The loop then moves on to the next line until all snippets have been processed.\n\nThis block represents the core automation flow where script text is transformed into fully generated, stored, and referenced video assets.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "adc37b2a-e1bf-4a1d-b222-a42bf5ed6335",
      "name": "Get Script",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        224,
        320
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.page }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1odA_IPe1h1K2jffAmS8KAow3A_iqOzmOKp261s9qjh8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1odA_IPe1h1K2jffAmS8KAow3A_iqOzmOKp261s9qjh8/edit?usp=drivesdk",
          "cachedResultName": "Gemini Speech Prompts"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "932f174c-1c23-438c-8f2e-4a8ef95ddd1e",
      "name": "Get Avatar Description",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -224,
        320
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 717424848,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1odA_IPe1h1K2jffAmS8KAow3A_iqOzmOKp261s9qjh8/edit#gid=717424848",
          "cachedResultName": "Gaia"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1odA_IPe1h1K2jffAmS8KAow3A_iqOzmOKp261s9qjh8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1odA_IPe1h1K2jffAmS8KAow3A_iqOzmOKp261s9qjh8/edit?usp=drivesdk",
          "cachedResultName": "Gemini Speech Prompts"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "c326e6c8-4f20-425f-9ecf-27f13601474d",
      "name": "Move on to next snippet",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1568,
        320
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "6102c8c9-154d-426e-9e4e-b79bd2163043",
      "name": "Set Loop Inputs",
      "type": "n8n-nodes-base.set",
      "position": [
        672,
        240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "55132fed-21ea-4159-9c25-5b514ddfe996",
              "name": "Gaia",
              "type": "string",
              "value": "={{ $('Global Variables').item.json.Description }}"
            },
            {
              "id": "c28da507-0df4-466a-8624-a66060ec4fc0",
              "name": "Speech",
              "type": "string",
              "value": "={{ $json.Speech }}"
            },
            {
              "id": "b433b063-9fbe-4ec9-b485-044e5d8dcf3b",
              "name": "framing",
              "type": "string",
              "value": "={{ $json.Framing }}"
            },
            {
              "id": "7fad23f3-3f63-4c49-99e8-1deeb28349f8",
              "name": "Description",
              "type": "string",
              "value": "={{ $json.Description }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "2646d8d9-75ff-4cb2-9c2d-7cfa27b2e054",
      "name": "Generate a video with Veo",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        896,
        240
      ],
      "parameters": {
        "prompt": "=Video opens with a midsize shot of avatar described below. They have a brown background behind them with subtle lightning bolts slowly appearing and disapearing in the background, but it's blurred to not draw attention. \n\navatar:\n{{ $json.Description }}\n\nFraming:\n{{ $json.framing }}\n\nShe says the following:\n\n{{ $json.Speech }}",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/veo-3.0-fast-generate-001",
          "cachedResultName": "models/veo-3.0-fast-generate-001"
        },
        "options": {
          "aspectRatio": "16:9",
          "sampleCount": 1,
          "durationSeconds": 8,
          "personGeneration": "allow_all",
          "binaryPropertyOutput": "data"
        },
        "resource": "video"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6e17cd44-5af2-41f0-bf60-19fdea626446",
      "name": "Upload video file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1120,
        240
      ],
      "parameters": {
        "name": "=Video {{ $('Loop Over Items').item.json.row_number }}.mp4",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "14TmRVP_anhGNV6RfCUWL6fLYm0aMwaXt",
          "cachedResultUrl": "https://drive.google.com/drive/folders/14TmRVP_anhGNV6RfCUWL6fLYm0aMwaXt",
          "cachedResultName": "Google Gemini AI Output"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "0291d4df-ea11-418e-a754-8543c93838ad",
      "name": "Update row in sheet with link to video",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1344,
        240
      ],
      "parameters": {
        "columns": {
          "value": {
            "Link": "={{ $json.webViewLink }}",
            "row_number": "={{ $('Loop Over Items').item.json.row_number }}"
          },
          "schema": [
            {
              "id": "Speech",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Speech",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Framing",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Framing",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Gaia?",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Gaia?",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Generate?",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Generate?",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Link",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Analysis",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Analysis",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "AI Prompt",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "AI Prompt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Global Variables').item.json.page }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1odA_IPe1h1K2jffAmS8KAow3A_iqOzmOKp261s9qjh8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1odA_IPe1h1K2jffAmS8KAow3A_iqOzmOKp261s9qjh8/edit?usp=drivesdk",
          "cachedResultName": "Gemini Speech Prompts"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    }
  ],
  "connections": {
    "Get Script": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Set Loop Inputs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Loop Inputs": {
      "main": [
        [
          {
            "node": "Generate a video with Veo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Global Variables": {
      "main": [
        [
          {
            "node": "Get Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload video file": {
      "main": [
        [
          {
            "node": "Update row in sheet with link to video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Avatar Description": {
      "main": [
        [
          {
            "node": "Global Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Move on to next snippet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate a video with Veo": {
      "main": [
        [
          {
            "node": "Upload video file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get Avatar Description",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet with link to video": {
      "main": [
        [
          {
            "node": "Move on to next snippet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}