๐Ÿ”ฌ Generate C API HTML docs from Google Drive headers with GPT-4o and Gmail

โšก 35 views ยท ๐Ÿ”ฌ Document Extraction & Analysis

Description

๐Ÿš€ Overview

This n8n workflow automatically generates professional API documentation from C header (.h) files using AI.

It scans a Google Drive folder for header files, extracts the source code, sends it to GPT-4o for structured analysis, and generates a beautiful HTML documentation page. The final documentation is uploaded back to Google Drive and a completion email is sent.

This workflow is ideal for embedded systems teams, firmware engineers, and SDK developers who want an automated documentation pipeline.


โœจ Key Features

โšก Fully automated documentation generation
๐Ÿ“ Reads .h files directly from Google Drive
๐Ÿค– Uses AI to analyze C APIs and extract documentation
๐Ÿ“‘ Generates clean HTML documentation
๐Ÿ“Š Documents functions, types, enums, and constants
๐Ÿ” Processes files one-by-one for reliability
โ˜๏ธ Saves generated documentation back to Google Drive
๐Ÿ“ง Sends a completion email notification


๐Ÿง  What the AI Extracts

The workflow automatically identifies and documents:


๐Ÿ–ฅ Generated Documentation

The output is a clean developer-friendly HTML documentation page including:

Perfect for:


โš™๏ธ Workflow Architecture

StepNodePurpose
1โ–ถ๏ธ Manual TriggerStarts the workflow
2๐Ÿ“‚ Get all filesReads files from Google Drive
3๐Ÿ”Ž Filter .h filesKeeps only header files
4๐Ÿ” Split in BatchesProcesses files sequentially
5โฌ‡๏ธ Download fileDownloads the header file
6๐Ÿ“– Extract textExtracts code content
7๐Ÿค– AI ExtractionAI extracts API structure
8๐Ÿงน Parse JSONCleans AI output
9๐ŸŽจ Generate HTMLBuilds documentation page
10โ˜๏ธ Upload to DriveSaves documentation
11๐Ÿ“ง Email notificationSends completion email

๐Ÿ”ง Requirements

To run this workflow you need:

๐Ÿ”น Google Drive OAuth2 credentials
๐Ÿ”น OpenAI API credentials
๐Ÿ”น Gmail credentials


๐Ÿ›  Setup Guide

1๏ธโƒฃ Configure Google Drive

Create two folders.

Source folder

Output folder

Update the folder IDs in the nodes:


2๏ธโƒฃ Configure OpenAI

Add an OpenAI credential in n8n.

Model used:

The model analyzes C header files and returns structured API documentation.


3๏ธโƒฃ Configure Gmail

Add a Gmail OAuth credential.

Update the recipient address inside:


โ–ถ๏ธ Run the Workflow

Click Execute Workflow.

The workflow will:

1๏ธโƒฃ Scan the Google Drive folder
2๏ธโƒฃ Process each .h file
3๏ธโƒฃ Generate HTML documentation
4๏ธโƒฃ Upload documentation to Drive
5๏ธโƒฃ Send a completion email


๐Ÿ–ผ Documentation Preview

API Documentation Example


๐Ÿ’ก Use Cases

๐Ÿ”ง Embedded firmware documentation
๐Ÿ“ฆ SDK documentation generation
๐Ÿง‘โ€๐Ÿ’ป Developer portal automation
๐Ÿ“š C library documentation
โš™๏ธ Continuous documentation pipelines


๐Ÿ”ฎ Future Improvements

This workflow can be extended with several enhancements:

๐Ÿ“„ PDF Documentation Export

Add a step to convert the generated HTML documentation into PDF files using tools such as:

This allows teams to distribute documentation as downloadable reports.


๐Ÿ” Local AI for Security (Ollama / Open-Source Models)

Instead of using the OpenAI node, the workflow can be modified to run fully locally using AI models such as:

These models can run on your own server, which provides:

๐Ÿ”’ Better data privacy
๐Ÿข No external API calls
โšก Faster responses on local infrastructure
๐Ÿ›ก Increased security for proprietary source code

This can be implemented in n8n using:


๐Ÿ“š Multi-Language Documentation

The workflow could also support additional languages such as: .c .cpp .hpp .rs .go

๐Ÿ”— Nodes Used

Google Drive, Gmail, Extract from File, OpenAI

๐Ÿ“ฅ Import

Download workflow.json and import into n8n: Workflow menu โ†’ Import from File

๐Ÿ“– Importing guide ยท ๐Ÿ”‘ Credential setup