{
  "id": "BuGoXATjseKjMTPb",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Generate Content Ideas with Gemini and Store in Google Sheets",
  "tags": [
    {
      "id": "ddPkw7Hg5dZhQu2w",
      "name": "AI",
      "createdAt": "2025-04-13T05:38:08.053Z",
      "updatedAt": "2025-04-13T05:38:08.053Z"
    },
    {
      "id": "ZOwtAMLepQaGW76t",
      "name": "Building Blocks",
      "createdAt": "2025-04-13T15:23:40.462Z",
      "updatedAt": "2025-04-13T15:23:40.462Z"
    },
    {
      "id": "Kujft2FOjmOVQAmJ",
      "name": "Engineering",
      "createdAt": "2025-04-09T01:31:00.558Z",
      "updatedAt": "2025-04-09T01:31:00.558Z"
    }
  ],
  "nodes": [
    {
      "id": "09c0ca0d-d7d1-4fbf-a24a-4e42d7dc90f5",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -540,
        -40
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "841332db-96ec-4892-a253-5de4194aa8e0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -380
      ],
      "parameters": {
        "width": 540,
        "height": 280,
        "content": "## Workflow Setup\n\n**Credentials:** Configure your Google AI and Google Sheets credentials in n8n.\n\n**Google Sheets:** Create a new Google Sheet or use an existing one. Note down the Spreadsheet ID (found in the URL)\n\n**Google Sheets Node:** Update the 'Write to Google Sheet' node with your Spreadsheet ID and desired sheet/range\n\nThis workflow generates content ideas using Google AI based on a topic and saves them to your Google Sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "d1ac37c4-554b-4d72-9f55-f922a2aeccee",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        480,
        -40
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "dbc70763-d6a2-4ca0-b146-32dd1c896fa5",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        280,
        -40
      ],
      "parameters": {
        "jsCode": "return $input.first().json.output"
      },
      "typeVersion": 2
    },
    {
      "id": "3001a6ba-6ce0-4eb8-b690-91a691c5542a",
      "name": "LLM Content Generator",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        960,
        -20
      ],
      "parameters": {
        "text": "=Provide me a blog post for the following title : {{ $json.title }} and description {{ $json.description }}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are an expert content generator"
            }
          ]
        },
        "promptType": "define"
      },
      "retryOnFail": true,
      "typeVersion": 1.7
    },
    {
      "id": "8f0b5c9d-81d8-49cd-80ff-cbb73742af49",
      "name": "Google Gemini Chat Model for Content Generation",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1060,
        140
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-exp"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b1661b78-752d-47c6-bb8d-87de862c12ed",
      "name": "Structured Output Parser for Content Idea Generator",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        80,
        140
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "[{\n\t\"type\": \"array\",\n\t\"properties\": {\n\t\t\"title\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"description\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}]"
      },
      "typeVersion": 1.2
    },
    {
      "id": "52f76748-1eac-406b-bacd-f27a65a69665",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1340,
        -20
      ],
      "parameters": {
        "columns": {
          "value": {
            "title": "={{ $('Set the title & description').item.json.title }}",
            "content": "={{ $json.text }}",
            "description": "={{ $('Set the title & description').item.json.description }}"
          },
          "schema": [
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "content",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "content",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "title"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/17ahJiPGh4mbW9VQpQ_3TZCU-VDV-YlkOKFEhoEU1Zgo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "17ahJiPGh4mbW9VQpQ_3TZCU-VDV-YlkOKFEhoEU1Zgo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/17ahJiPGh4mbW9VQpQ_3TZCU-VDV-YlkOKFEhoEU1Zgo/edit?usp=drivesdk",
          "cachedResultName": "Content Ideas"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "c6f1cf1b-89f7-4796-bb20-d8d0a6751a0e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        60,
        -380
      ],
      "parameters": {
        "color": 4,
        "width": 540,
        "height": 280,
        "content": "## Google Sheet\n\nMake sure to have the following column names on your google sheet.\n\n1. title\n2. description\n3. content"
      },
      "typeVersion": 1
    },
    {
      "id": "c339eb0f-4978-46b0-a63d-492b7b69a731",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        660,
        -380
      ],
      "parameters": {
        "color": 5,
        "width": 440,
        "height": 240,
        "content": "## LLM Usages\n\nGoogle Gemini LLM is being utilized for the structured data extraction handling."
      },
      "typeVersion": 1
    },
    {
      "id": "8f8e28b1-3466-48aa-afab-2f0f4f071ddf",
      "name": "Set the title & description",
      "type": "n8n-nodes-base.set",
      "position": [
        700,
        -20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "25acf070-f986-4872-bc30-7ea8143c4b70",
              "name": "title",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "522324ba-b6c3-4650-b447-469edcc08aee",
              "name": "description",
              "type": "string",
              "value": "={{ $json.description }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ef4b937f-9d16-4747-b863-6b75d79e2319",
      "name": "Set the input fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -320,
        -40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "7a1fd824-9256-4a4e-aab6-f86506c0cc91",
              "name": "topic",
              "type": "string",
              "value": "Web scraper"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4ed4561e-915d-4ebe-aff6-2cb16720a02e",
      "name": "Content Idea Generator",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -100,
        -40
      ],
      "parameters": {
        "text": "=Generate 5 content ideas related to the following topic: {{ $json.topic }}\n\nOutput the response in the following schema.\n\nJSON Schema\n\n[{\n\t\"type\": \"array\",\n\t\"properties\": {\n\t\t\"title\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"description\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}]",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are an expert content generator"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 1.7
    },
    {
      "id": "f48de4f1-c46f-4134-afed-e3fcf552f79c",
      "name": "Google Gemini Chat Model for Content Idea Generator",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -100,
        140
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-exp"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "dc820836-0e70-4b3e-856a-68a5f27faab9",
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Set the title & description",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the input fields": {
      "main": [
        [
          {
            "node": "Content Idea Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LLM Content Generator": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Content Idea Generator": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the title & description": {
      "main": [
        [
          {
            "node": "LLM Content Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Set the input fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model for Content Generation": {
      "ai_languageModel": [
        [
          {
            "node": "LLM Content Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model for Content Idea Generator": {
      "ai_languageModel": [
        [
          {
            "node": "Content Idea Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser for Content Idea Generator": {
      "ai_outputParser": [
        [
          {
            "node": "Content Idea Generator",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}