{
  "id": "h0WoIwI2MdweZH6G",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Automate blog HTML creation from PDF using Google Drive and OpenAI",
  "tags": [],
  "nodes": [
    {
      "id": "10d3c8a9-737a-4d8a-a669-c81e5e8cf731",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "8cf02caa-0858-4550-840b-2901aee74fd3",
      "name": "Search files and folders",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        208,
        0
      ],
      "parameters": {
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "list",
            "value": "1yGtryEiiR2k1T97JlxYBYQETmz0TVKnd",
            "cachedResultUrl": "https://drive.google.com/drive/folders/1yGtryEiiR2k1T97JlxYBYQETmz0TVKnd",
            "cachedResultName": "Input-PDFs"
          }
        },
        "options": {
          "fields": [
            "id",
            "name"
          ]
        },
        "resource": "fileFolder",
        "returnAll": true
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3,
      "alwaysOutputData": true
    },
    {
      "id": "965ff1cd-6ea3-4767-be50-424fb86791aa",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        416,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "3ff1d3c6-200f-40e8-b63a-78e0a07b73be",
      "name": "Download file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        624,
        16
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Search files and folders').item.json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "38d2fd78-64ff-4ee4-a518-4e1b485424d6",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        832,
        16
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1.1
    },
    {
      "id": "083107ff-776b-4bfe-beef-04947b107b73",
      "name": "Message a model",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1040,
        16
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=You are a professional SEO blog writer specializing in finance and markets working at AngelOne.\n\nYour task:\nConvert the following extracted PDF content into a high-quality, SEO-optimized blog article.\n\nRequirements:\n\n1. Minimum 1200 words\n2. Strong engaging headline (H1)\n3. Clear H2 and H3 subheadings\n4. Bullet points where useful\n5. Add practical insights\n6. Add conclusion with summary\n7. Add a short meta description (150\u2013160 characters) at the end\n8. Make it human, not robotic\n9. Do NOT mention that this came from a PDF\n10. Avoid repeating the same sentences\n11. SEO Friendly keywords \n12. Read complete PDF and then only make Blog\n13. Should be in HTML format\n\n\nTone:\nClear, confident, intelligent, practical.\n\nContent to convert:\n------------------------\n{{ $json.text }}\n------------------------\n\nOutput format:\n\n# Main Headline\nDate\n\nBlog content here...\n\nMeta Description:\n..."
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "fe417275-a041-45b8-95e4-242cbc1016f8",
      "name": "Create file from text",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1392,
        16
      ],
      "parameters": {
        "name": "={{ $('Search files and folders').item.json.name.split('.').slice(0, -1).join('.') + '.html' }}",
        "content": "={{ $json.output[0].content[0].text }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1p1FKCQ3aCqWVWcxbUEqTOuiXTfsB7tCP",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1p1FKCQ3aCqWVWcxbUEqTOuiXTfsB7tCP",
          "cachedResultName": "Generated-Blogs"
        },
        "operation": "createFromText"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "5325fd1c-1cb8-4113-b5c8-1bd165cebe92",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        -1008
      ],
      "parameters": {
        "width": 1616,
        "height": 736,
        "content": "# Automate blog HTML creation from PDF using Google Drive and OpenAI\nThis workflow converts PDF files stored in Google Drive into SEO-optimized blog HTML using OpenAI.\nIt retrieves PDFs from a selected folder, extracts the text, sends it to OpenAI with a structured SEO prompt, and saves the generated HTML file back to Google Drive.\n---\n## How it works\n\n1. Fetch PDFs from a Drive folder  \n2. Process files sequentially to avoid API limits  \n3. Extract text from each PDF  \n4. Send content to OpenAI for SEO blog generation  \n5. Save the generated HTML file to a destination folder  \n---\n## Setup steps\n\n1. Connect Google Drive credentials  \n2. Connect OpenAI API credentials  \n3. Select source (PDF) and destination (HTML) folders  \n4. Adjust the prompt if needed  \n5. Test with a sample PDF  \n\nOnce configured, any PDF added to the source folder can be converted into blog-ready HTML."
      },
      "typeVersion": 1
    },
    {
      "id": "1cd90d88-a16b-4b4e-869b-6a208cab3ff2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "content": "PDF retrieval and sequential processing\n\n\u2022 Search files in source folder\n\u2022 Loop through each file\n\u2022 Download and extract text"
      },
      "typeVersion": 1
    },
    {
      "id": "470c0c2f-65f1-4c88-af97-77f58bd513f2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        -176
      ],
      "parameters": {
        "color": 7,
        "content": "HTML file creation\n\n\u2022 Converts AI response to file\n\u2022 Saves .html file to destination folder\n\u2022 Keeps original filename structure"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "e1b13218-9d2c-4cda-89bb-134fba68d1be",
  "connections": {
    "Download file": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Create file from text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create file from text": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search files and folders": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}