One-way sync from Google Docs to Markdown.
- Converts Google Docs to Markdown with frontmatter
- Multi-tab document support (creates separate files per tab)
- Extracts and downloads inline images
- Converts comments to footnotes
- Multi-account support for different Google accounts
- Atomic file writes for safety
# Clone the repo
git clone https://github.com/derek/docpull.git
cd docpull
# Install with uv
uv sync
# Run
uv run docpull --helppip install .
docpull --help- Go to Google Cloud Console
- Create a new project or select existing
- Enable Google Docs API and Google Drive API
- Create OAuth 2.0 credentials (Desktop app)
- Download the client secrets JSON
- Save it to
~/.config/docpull/client_secrets.json
On first run, docpull creates a default config at ~/.config/docpull.json:
{
"default_account": "personal",
"accounts": {
"personal": {
"email": "",
"image_dir": "~/Documents/docpull-images/personal"
}
}
}Edit this file to:
- Set your email (optional, for reference)
- Configure the image directory where extracted images will be saved
- Add additional accounts if needed
# Sync a document by URL
docpull "https://docs.google.com/document/d/ABC123/edit" --output ~/Documents/my-doc.md
# Sync by document name (searches your Drive)
docpull "My Document Title" --output ~/Documents/my-doc.md
# Use a specific account
docpull "https://..." --output doc.md --account work
# Overwrite without confirmation
docpull "https://..." --output doc.md --force
# Skip image downloads
docpull "https://..." --output doc.md --no-images
# Get agent-optimized usage guide (for AI agents)
docpull --help-agentFor documents with multiple tabs, docpull creates separate files:
my-doc-Tab1.md
my-doc-Tab2.md
my-doc-Tab3.md
Each Markdown file includes YAML frontmatter with metadata:
---
title: Document Title
gdoc_id: ABC123...
gdoc_url: https://docs.google.com/document/d/ABC123/edit
account: personal
last_synced: 2024-01-15T10:30:00Z
created: 2024-01-01T09:00:00Z
last_edited: 2024-01-15T10:00:00Z
author: John Doe
---Comments from the Google Doc are converted to footnotes at the end of the document.
- Default:
~/.config/docpull.json - Override with
--config /path/to/config.json
- Client secrets:
~/.config/docpull/client_secrets.json - OAuth tokens:
~/.config/docpull/credentials-{account}.json
{
"default_account": "personal",
"accounts": {
"personal": {
"email": "me@gmail.com",
"image_dir": "~/Documents/docpull-images/personal"
},
"work": {
"email": "me@company.com",
"image_dir": "~/Documents/docpull-images/work"
}
}
}Use --account work to sync documents from your work account.
Clone the repo and install in editable mode:
git clone https://github.com/derek/docpull.git
cd docpull
uv syncuv sync installs the project in editable mode, so changes to src/ take
effect immediately when you run uv run docpull.
MIT