Skip to content

Building a Zero-Cost Headless CMS with Google Workspace & Apps Script

31 July 2026 BY: Nicola Berry

Most modern Jamstack and Astro websites rely on third-party Headless CMS platforms like Contentful, Sanity, or Strapi. While functional, these platforms introduce monthly subscription costs, complex API tier limits, and external security dependencies.

For business owners who already live inside Google Workspace, there is a much cleaner, 100% sovereign solution: using Google Drive and Google Sheets as a Headless CMS.

In this technical breakdown, we detail how we engineered a custom publishing engine using Google Apps Script and the GitHub REST API.


1. The Operational Challenge

Content publishing for modern high-performance web frameworks usually requires one of two compromises:

  1. Developer Friction: Opening a code editor (like VS Code), writing raw Markdown files, managing local images, and executing git commands.
  2. SaaS Vendor Trap: Paying £50–£200/month for a dedicated Headless CMS with rigid user seats and tier limits.

We wanted a solution that offered the intuitive rich-text editing of Google Docs, the organised relational overview of Google Sheets, and £0 monthly ongoing costs.


2. Technical Architecture Overview

The system operates via an event-driven pipeline that bridges Google Workspace with GitHub and Vercel:

[ Google Doc (Draft) ] ──► [ Master Sheet Queue ] ──► [ Google Apps Script Parser ] ──► [ GitHub REST API ] ──► [ Vercel Auto-Deploy ]

Key Components:

  1. Master Control Sheet: Tracks content metadata (Title, Slug, Category, Summary, Read Time, Status, and GitHub SHA).
  2. Google Doc Editor: Allows authors to draft content using native headings, bold/italic text, lists, and tables.
  3. Apps Script Parser (DocToMarkdown.gs): Reads Google Doc DOM elements and converts rich text into validated MDX with YAML frontmatter.
  4. GitHub REST Client (GitHubApi.gs): Uses Base64 encoding and GitHub’s /contents/ API to commit .mdx files directly to the repository.
  5. Vercel CI/CD Pipeline: Automatically detects GitHub commits and builds the production site live within 45 seconds.

3. Under the Hood: The MDX Conversion Engine

The core of the system is the AST-like parser written in Google Apps Script. It inspects Google Doc element types line-by-line and translates them into Astro-compatible MDX:

// Sample snippet from DocToMarkdown.gs
if (heading === DocumentApp.ParagraphHeading.HEADING1) {
  mdxLines.push(`# ${parseFormattedText(paragraph)}`);
} else if (heading === DocumentApp.ParagraphHeading.HEADING2) {
  mdxLines.push(`## ${parseFormattedText(paragraph)}`);
}

Frontmatter Generator

The engine automatically injects structured YAML frontmatter at the top of every generated file:

---
title: "Building a Zero-Cost Headless CMS"
pubDate: "2026-07-31"
category: "Case Studies"
author: "Nicola Berry"
readTime: "6 min read"
icon: "Cpu"
---

4. State Management & Idempotency

To prevent duplicate commits and enable seamless post updates, the Apps Script saves the GitHub SHA hash back into a hidden column in the Master Sheet.

When an author edits an existing Google Doc and clicks Sync, Apps Script supplies the existing SHA in its GitHub API PUT payload. GitHub treats this as an in-place edit rather than a duplicate file creation.


5. Results & Performance

  • Publishing Speed: 45 seconds from clicking “Publish” in Google Sheets to live deployment on Vercel.
  • Cost: £0/month in CMS SaaS fees.
  • Data Sovereignty: 100% ownership of source content in Google Workspace and Git.
  • Workflow Freedom: Articles can be drafted on mobile, tablet, or desktop via standard Google Drive applications.

By leveraging native Google Apps Script APIs, businesses can build enterprise-grade automation infrastructure directly within their existing Google Workspace tools.

Google Workspace

Professional Email & Tools for Your Business

Get you@yourcompany.com, plus video meetings, secure cloud storage, and the powerful admin controls you need to scale. Same tools I use to build your automations.

Custom business email
Secure file sharing & collaboration
Security and management controls