google-docs-md

$npx mdskill add joelhooks/joelclaw/google-docs-md

Export Google Docs to markdown via native URL parameters for vault ingestion or doc-to-markdown pipelines.

  • Helps fetch Google Doc content for runbook building or content extraction without scraping tools.
  • Integrates with Google Docs using its native export feature via URL patterns.
  • Decides to execute by extracting document IDs from URLs and applying the export format parameter.
  • Delivers results as markdown files through HTTP requests, handling redirects for public docs.

SKILL.md

.github/skills/google-docs-mdView on GitHub ↗
---
name: google-docs-md
displayName: Google Docs Markdown Export
description: Export Google Docs as clean markdown via native URL parameter. No auth needed for public docs. Use when fetching Google Doc content for vault ingestion, runbook building, or any doc-to-markdown pipeline.
version: 0.1.0
author: joel
tags:
  - google-docs
  - markdown
  - export
  - content-extraction
---

# Google Docs Markdown Export

Google Docs natively supports markdown export via a URL parameter. This is the most reliable way to get markdown from a Google Doc — better than defuddle, jina, or any scraping tool.

## URL Pattern

For any Google Doc URL like:
```
https://docs.google.com/document/d/{DOC_ID}/edit?tab=t.0
```

Replace everything after the document ID with `export?format=md`:
```
https://docs.google.com/document/d/{DOC_ID}/export?format=md
```

## Extracting the Document ID

The DOC_ID is the long alphanumeric string between `/d/` and the next `/`:

```bash
# From any Google Docs URL, extract the ID:
echo "https://docs.google.com/document/d/1mt8aYM88Jj5qkep1xYC5vj0wBlbX2u6gdxhf_puaiQI/edit?tab=t.0" \
  | grep -oP '(?<=/d/)[^/]+'
# → 1mt8aYM88Jj5qkep1xYC5vj0wBlbX2u6gdxhf_puaiQI
```

## Fetching

```bash
# Public docs — no auth needed, follow the 307 redirect:
curl -L "https://docs.google.com/document/d/${DOC_ID}/export?format=md" -o output.md

# Private docs — needs OAuth bearer token:
curl -L "https://docs.google.com/document/d/${DOC_ID}/export?format=md" \
  -H "Authorization: Bearer ${TOKEN}" -o output.md
```

**Important:** The endpoint returns a `307` redirect. Always use `curl -L` (follow redirects) or equivalent.

## Other Export Formats

The same pattern works for other formats:
- `export?format=pdf` — PDF
- `export?format=docx` — Word
- `export?format=txt` — Plain text
- `export?format=html` — HTML
- `export?format=epub` — ePub

## Batch Pattern

When you have a list of Google Doc URLs (e.g. extracted from Front emails):

```bash
# Extract doc IDs from a file of URLs
grep -oP '(?<=/d/)[^/]+' urls.txt | sort -u | while read id; do
  echo "Fetching $id..."
  curl -sL "https://docs.google.com/document/d/${id}/export?format=md" \
    -o "docs/${id}.md"
  sleep 1  # Be polite
done
```

## When to Use

- **Always prefer this** over defuddle/scraping for Google Docs
- Works for public docs without any authentication
- Native markdown quality is superior to any HTML→markdown conversion
- Handles tables, formatting, links, images (as URLs) correctly

## Limitations

- Private docs require a valid OAuth token (use `gog` when available)
- Very large docs may take a few seconds
- Images are referenced as URLs, not embedded
- Comments and suggestions are not included in the export

More from joelhooks/joelclaw

SkillDescription
add-skillCreate new joelclaw skills with the idiomatic process — repo-canonical, symlinked, git-tracked, slogged. Triggers on 'add a skill', 'create skill', 'new skill', 'canonical skill', 'make a skill for', or any request to formalize a process or domain into a reusable skill.
adr-skillCreate and maintain Architecture Decision Records (ADRs) optimized for agentic coding workflows. Use when you need to propose, write, update, accept/reject, deprecate, or supersede an ADR; bootstrap an adr folder and index; consult existing ADRs before implementing changes; or enforce ADR conventions. This skill uses Socratic questioning to capture intent before drafting, and validates output against an agent-readiness checklist.
agent-discovery"Optimize websites, docs, and product surfaces for agent discoverability and operator UX. Use when working on agent SEO/AEO/GEO, crawl policy, markdown or JSON projections, llms.txt, sitemap.md, AGENTS.md guidance, content negotiation, accessibility for browser agents, or any request to make a site easier for pi, OpenCode, Claude Code, ChatGPT, Perplexity, or other agent harnesses to find and use."
agent-loopStart, monitor, and cancel durable multi-agent coding loops via Inngest. Use when the user wants to run autonomous coding workloads, execute a PRD with multiple stories, kick off an AFK coding session, have agents implement features from a plan, or manage running loops. Triggers on "start a coding loop", "run this PRD", "implement these stories", "go AFK and code this", "check loop status", "cancel the loop", "joelclaw loop", or any request for autonomous multi-story code execution.
agent-mail>-
agent-workloads"Compatibility alias for the canonical `workflow-rig` front door. Use when older prompts mention `agent-workloads` or when you need the legacy workload-planning guidance; for new work, load `workflow-rig` first."
clawmail>-
cli-design"Design and build agent-first CLIs with HATEOAS JSON responses, context-protecting output, and self-documenting command trees. Use when creating new CLI tools, adding commands to existing CLIs (joelclaw, slog), or reviewing CLI design for agent-friendliness. Triggers on 'build a CLI', 'add a command', 'CLI design', 'agent-friendly output', or any task involving command-line tool creation."
codex-prompting"Use this skill for any request to trigger, coordinate, or craft prompts for Codex. Use when user says 'send to codex', 'use codex', 'prompt codex', 'ask codex', 'delegate to codex', 'run in codex', or asks for a Codex-first execution handoff."
content-publish"Publish content to joelclaw.com via the Convex-first pipeline. Covers the full lifecycle: draft → review → publish → revalidate → verify. Handles secret leasing, tag conventions, content types (article, tutorial, note, essay), and verification gates. Use when: 'write article about X', 'publish article <slug>', 'draft a tutorial', 'publish this', 'push to convex', or any content publishing task."