HomeAI AutomationHow to Auto-Generate SWOT Analysis PDF…
AI Automation

How to Auto-Generate SWOT Analysis PDF Reports with n8n and AI

How to Auto-Generate SWOT Analysis PDF Reports with n8n and AI

Writing a SWOT analysis takes hours — researching the market, consulting stakeholders, structuring the findings, and then wrestling with formatting in Word or Google Docs. If you’re a consultant, analyst, or business owner who produces these reports regularly, that time adds up fast. This n8n workflow replaces that process with four specialized AI agents that analyze Strengths, Weaknesses, Opportunities, and Threats in parallel, then stitch the results into a professionally formatted PDF and deliver it straight to your inbox.

Prefer to skip the setup? Grab the ready-made template → and be up and running in under 10 minutes.

What You’ll Build

  1. You add a company’s profile (name, industry, size, market region) to a Google Sheet — one row per company you want analyzed.
  2. You trigger the workflow with one click. Four AI agents instantly spin up in parallel and each writes a deep analysis of one SWOT quadrant.
  3. A fifth agent writes the introduction, a sixth writes the conclusion, and a seventh assembles the table of contents and title page.
  4. All sections are saved back to your Google Sheet as a structured record, then merged and sent to APITemplate.io to render a polished PDF.
  5. The finished PDF lands in your Gmail inbox, ready to share with a client or stakeholder — no manual formatting required.

How It Works — The Big Picture

The workflow reads a single row of company data from Google Sheets, fans out to four parallel analysis agents, formats each section, then reconverges to generate the PDF and send it by email. The entire flow runs sequentially where needed and in parallel where possible, keeping generation time to a minimum.

+-------------------------------------------------------------------------+
|  SWOT ANALYSIS PDF REPORT GENERATOR                                     |
|                                                                         |
|  [Manual Trigger]                                                       |
|       |                                                                 |
|  [Google Sheets -- Read Company Row]                                    |
|       |                                                                 |
|  [AI Agent -- SWOT Coordinator]  <-- OpenAI GPT-4                      |
|       |                                                                 |
|  +----+--------------------------------------+                          |
|  v          v           v           v                                   |
| [Strengths] [Weaknesses] [Opportunities] [Threats]  <- parallel agents |
|  v          v           v           v                                   |
| [Format S] [Format W]  [Format O]  [Format T]                          |
|  +----+--------------------------------------+                          |
|       v                                                                 |
|  [Merge All Sections]                                                   |
|       |                                                                 |
|  [Write Introduction]  [Write Conclusion]  [Title Page + ToC]          |
|       +----------------------------------+------------------+           |
|                             [Pull from Sheets]                          |
|                                  |                                      |
|                        [Combine All Content]                            |
|                                  |                                      |
|                    [Generate PDF via APITemplate.io]                    |
|                                  |                                      |
|                        [Download PDF File]                              |
|                                  |                                      |
|                      [Send Report via Gmail]                            |
+-------------------------------------------------------------------------+
  

What You’ll Need

  • n8n instance — self-hosted or n8n Cloud (v1.60+ recommended)
  • OpenAI API key — GPT-4 or GPT-4o access required
  • DeepSeek API key — used for the reasoning-heavy analysis phase (optional but improves depth)
  • Google Sheets — with OAuth2 connected to n8n; one sheet for input data, one for storing generated sections
  • APITemplate.io account — free plan works for testing; paid plan for production volume
  • Gmail account — connected to n8n via OAuth2 for report delivery

Estimated build time: 45-90 minutes from scratch, or under 10 minutes with the template.

Part 1 — Reading Company Data

1 Manual Trigger (Trigger)

This workflow starts manually — you click “Test workflow” (or call the workflow via another automation). The trigger passes no data; it simply kicks off the flow so the next node can read from your Google Sheet.

💡

Tip: You can easily swap this for a Schedule Trigger to run the analysis automatically every Monday morning, or a Webhook Trigger so an external system (like a CRM) can fire it on demand.

2 Google Sheets — Read Company Row

This node reads your input spreadsheet and pulls the company profile for analysis. Configure it to read a single row at a time — either the first row, or use a filter to target a specific company name.

{
  "Company Name": "Apex Logistics Inc.",
  "Industry": "Third-Party Logistics (3PL)",
  "Business Size": "Mid-market (250-500 employees)",
  "Market Region": "Southeast United States"
}
📌

Important: The column names in your sheet must exactly match what the AI agent nodes reference in their prompts. If you rename a column, update the corresponding agent prompt too.

Part 2 — Parallel SWOT Analysis

3 AI Agent — SWOT Coordinator

This central agent receives the full company profile and fans out to the four specialized analysis agents. It uses OpenAI GPT-4 and a Structured Output Parser to ensure the data passed downstream is consistently formatted.

{
  "companyName": "Apex Logistics Inc.",
  "industry": "Third-Party Logistics (3PL)",
  "businessSize": "Mid-market (250-500 employees)",
  "marketRegion": "Southeast United States",
  "analysisContext": "Focus on competitive landscape, operational efficiency, and regional market dynamics."
}

4 Strengths Analysis Agent

One of four parallel agents. This one is prompted to identify the company’s internal competitive advantages — things like proprietary technology, strong customer relationships, operational efficiencies, or brand recognition. It draws on the industry and business size context to make the analysis specific rather than generic.

{
  "section": "strengths",
  "points": [
    "Established network of 12 regional distribution centers across the Southeast",
    "Proprietary real-time shipment tracking system with 99.4% accuracy",
    "Long-term contracts with 3 of the top 10 US e-commerce retailers",
    "Low driver turnover rate (8%) compared to industry average (35%)"
  ],
  "summary": "Apex Logistics benefits from deep regional infrastructure and technology investments that create significant switching costs for key clients."
}
💡

Tip: All four analysis agents share the same OpenAI Chat Model node — n8n lets multiple agents reference one credential/model without duplicating the node. This keeps your workflow clean and makes it easy to swap models globally.

5 Weaknesses Analysis Agent

Prompts the model to think critically about internal limitations — gaps in technology, talent, financial resources, or operational coverage. The output mirrors the same JSON structure as the Strengths agent for easy merging downstream.

6 Opportunities Analysis Agent

Shifts focus externally: what market trends, regulatory changes, customer segments, or partnership opportunities could this company exploit? This agent benefits most from the “Market Region” field — it allows the AI to tailor its recommendations to specific geographic dynamics.

7 Threats Analysis Agent

Identifies external risks: new competitors, regulatory headwinds, supply chain vulnerabilities, macroeconomic factors. This agent uses the DeepSeek Reasoner model by default (you can configure it to use GPT-4) because threat analysis benefits from deeper causal reasoning.

Part 3 — Formatting and Assembly

8 Section Formatting Agents (x4)

After analysis, four formatting agents take each raw JSON section and convert it into polished prose — proper paragraphs, transitions, and a professional tone suitable for an executive report. Each formatting agent saves its output back to a dedicated Google Sheet tab, creating a persistent record of every analysis run.

{
  "section": "strengths",
  "formattedText": "Apex Logistics has built a formidable operational foundation across the Southeast United States. The company's network of 12 regional distribution centers ensures next-day delivery coverage for over 85% of the regional population -- a geographic footprint that would take years and significant capital for a new entrant to replicate.\n\nThe proprietary tracking system, developed in-house over six years, delivers 99.4% shipment accuracy and has become a key differentiator in contract renewals..."
}

9 Merge All SWOT Sections

The n8n Merge node waits for all four formatting branches to complete, then combines their outputs into a single item that flows forward. This is the synchronization point — nothing moves to the introduction or conclusion until all four SWOT sections are ready.

10 Write Introduction & Conclusion Agents

Two additional AI agents generate the bookends of the report. The introduction agent receives a summary of all four sections and writes a context-setting executive overview. The conclusion agent synthesizes the findings into strategic recommendations. Both use GPT-4o for speed.

11 Combine All Content (Code Node)

A JavaScript code node pulls all sections from Google Sheets (via several “Pull from Sheets” nodes), assembles them in the correct order — Title Page, ToC, Introduction, Strengths, Weaknesses, Opportunities, Threats, Conclusion — and formats the combined content into the JSON structure APITemplate.io expects.

// Combine all report sections in order
const sections = {
  titlePage: $('Extract Company Name').item.json.companyName,
  tableOfContents: $('Save Table of Contents to Sheets').item.json.tocContent,
  introduction: $('Upload Introduction').item.json.formattedText,
  strengths: $('Upload Strengths').item.json.formattedText,
  weaknesses: $('Upload Weaknesses').item.json.formattedText,
  opportunities: $('Upload Opportunities').item.json.formattedText,
  threats: $('Upload Threats').item.json.formattedText,
  conclusion: $('Upload Conclusion').item.json.formattedText
};

return [{ json: { reportData: sections, generatedAt: new Date().toISOString() } }];

Part 4 — PDF Generation and Delivery

12 Generate PDF via APITemplate.io

This HTTP Request node sends the assembled report data to APITemplate.io’s PDF generation API. APITemplate renders the content using a pre-built professional template (think letterhead, consistent typography, section dividers) and returns a download URL for the finished PDF.

💡

Tip: APITemplate.io lets you design your own PDF templates using a drag-and-drop editor. You can match the report to your brand colors, add a logo, and create custom section styles — all without touching CSS or LaTeX.

13 Download PDF & Send via Gmail

The Download PDF node fetches the binary file from APITemplate’s URL, and the Gmail node attaches it to an email addressed to the analyst or stakeholder. The subject line and body are dynamically populated with the company name and generation timestamp.

The Data Structure

Your Google Sheet needs two tabs: an Input tab (one row per company to analyze) and an Output tab (where generated sections are stored). The input schema is simple:

Column Type Example Description
Company Name Text Apex Logistics Inc. The full company name — used in the report title and throughout the analysis
Industry Text Third-Party Logistics (3PL) The industry sector — helps AI agents contextualize competitive dynamics
Business Size Text Mid-market (250-500 employees) Company size — affects which strengths/weaknesses are relevant
Market Region Text Southeast United States Geographic focus — used for market-specific opportunity and threat analysis
Status Text Pending / Completed Optional status field — useful if you process a queue of companies
📌

Column names must match exactly (including capitalization and spaces) — the AI agent prompts reference them by name using n8n expressions like {{ $json["Company Name"] }}.

Full System Flow

  Google Sheet (Input Tab)
         |
         v
  +------------------+
  |  Read Company    |  -> Company Name, Industry, Size, Region
  |  Profile         |
  +------------------+
         |
         v
  +----------------------------------------------------------+
  |              SWOT Coordinator Agent (GPT-4)              |
  +----------------------------------------------------------+
    |           |              |              |
    v           v              v              v
 [Strengths] [Weaknesses] [Opportunities] [Threats]
  (GPT-4)    (GPT-4)        (GPT-4)      (DeepSeek)
    |           |              |              |
    v           v              v              v
 [Format S] [Format W]   [Format O]    [Format T]
    |           |              |              |
    +-----------+-------+------+--------------+
                        v
                [Merge All Sections]
                        |
           +------------+------------+
           v            v            v
     [Introduction] [Conclusion] [Title + ToC]
           |            |            |
           +------------+----+-------+
                            v
              Google Sheets (Output Tab -- persist all sections)
                            |
                            v
                 [Combine All Content]
                            |
                            v
              [APITemplate.io -- Generate PDF]
                            |
                            v
                    [Download PDF]
                            |
                            v
              [Gmail -- Send Report to Inbox]
  

Testing Your Workflow

  1. Add one row to your Google Sheet with a real company you know well (e.g., a local business or well-known brand in your industry).
  2. Open the workflow in n8n and click Test workflow.
  3. Watch the execution — each agent node should light up green within 30-60 seconds as the AI generates content.
  4. Check your Google Sheets Output tab — you should see the formatted sections appear as the agents complete.
  5. After all nodes complete successfully, check your Gmail inbox for the PDF report.
Problem Likely Cause Fix
AI Agent node fails with 400 error OpenAI credential not configured or invalid API key Go to n8n Credentials → OpenAI → re-enter your API key and test connection
Google Sheets node returns empty data Spreadsheet ID or sheet name not updated after import Open the Google Sheets node, click the Spreadsheet URL field, and reselect your sheet
APITemplate.io returns 401 Unauthorized APITemplate API key missing or expired Log in to APITemplate.io → Account → API Keys → copy the key into n8n’s HTTP Request node header
Gmail node fails to send OAuth scope doesn’t include “Send email” Reconnect the Gmail credential in n8n and ensure “Compose and send” scope is granted
PDF is blank or missing sections One of the SWOT agents timed out or returned empty output Re-run the workflow; if it persists, add error handling (IF node) after each agent to catch empty responses

Frequently Asked Questions

Can I analyze multiple companies in one run?

The current template processes one company at a time to stay within OpenAI rate limits and keep execution predictable. To process a batch, add a Loop node before the Google Sheets read step and iterate through each row with a status of “Pending”. Update the status to “Completed” after the PDF is sent.

How much does this workflow cost to run per report?

Using GPT-4o for the four SWOT agents, introduction, conclusion, and table of contents, a single full report typically uses 8,000-14,000 tokens across all calls — roughly $0.08-$0.14 at current GPT-4o pricing. APITemplate.io’s free plan includes 50 PDF renders per month. So for moderate use, the ongoing cost is very low.

Can I use a different AI model instead of GPT-4?

Yes. Each AI Agent node lets you swap the connected language model independently. You can use GPT-4o mini for faster, cheaper runs, Claude via OpenRouter for a different analytical style, or Gemini if you prefer Google’s ecosystem. The Structured Output Parser will still enforce the expected JSON shape regardless of which model you use.

Does the workflow work on n8n Cloud, or only self-hosted?

It works on both n8n Cloud and self-hosted instances running n8n v1.60 or later. The only requirement is that your n8n instance can reach the OpenAI API, Google APIs, and APITemplate.io over HTTPS — which any standard deployment supports.

Can I customize the PDF template design?

Absolutely. Log in to APITemplate.io and open your template in the editor. You can change fonts, colors, add your company logo, modify section layouts, and add a cover page image. Once you save the template, the workflow will automatically use the updated design the next time it runs.

What if I don’t want to use APITemplate.io?

You have two alternatives: use the n8n HTML node to render the content as an HTML file and convert it with a headless Chrome service like Browserless, or export the sections to a Google Doc and use the Google Drive API to export it as PDF. The APITemplate.io approach is recommended because it requires no additional infrastructure and produces the most polished output.

🚀 Get the SWOT Analysis PDF Report Template

Skip the build — get the fully configured workflow JSON, a pre-built Google Sheets input template, and step-by-step setup and credentials guides so you’re generating professional SWOT reports in minutes.

Get the Template →

Instant download · Works on n8n Cloud and self-hosted · $14.99

What’s Next?

  • Competitor comparison mode: Analyze 3-5 competitors in one run and add a comparison table to the PDF showing how your company stacks up across each SWOT quadrant.
  • CRM integration: Trigger the workflow from HubSpot or Salesforce when a new prospect is added, and automatically attach the SWOT PDF to their contact record.
  • Slack/Teams delivery: Add a Slack or Teams node after the Gmail step to post a summary of the key findings to a team channel as soon as the report is ready.
  • Scheduled competitive intelligence: Run the workflow monthly on your key accounts to track how their SWOT profile evolves over time, building a longitudinal record in Google Sheets.
n8n
OpenAI
Google Sheets
APITemplate.io
SWOT Analysis
PDF Report
AI Agents
Business Automation