Skip to content

clawoneloke/gdocs-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Docs Skill for OpenClaw

Direct Google Docs integration for OpenClaw using gogcli as a wrapper.

Overview

This skill enables OpenClaw to read, create, and manage Google Docs directly through WhatsApp or other connected channels. It uses gogcli for Google Workspace API integration.

Features

  • Read Documents - Download and display document content
  • List Documents - Browse documents from Google Drive
  • Create Documents - Create new Google Docs
  • Get Metadata - View document title, size, last modified date
  • Edit Documents - Find and replace text (creates new document)
  • Mark Tasks Complete - Append completion notes to documents

Setup

Prerequisites

  • Node.js 18+
  • gogcli installed and configured
  • Google Workspace credentials

Installation

# Clone the repository
git clone https://github.com/clawoneloke/gdocs-skill.git
cd gdocs-skill

# Install dependencies
npm install

# Set up gogcli if not already installed
# Download from: https://github.com/therealglazou/gogcli

# Configure gogcli with your Google credentials
~/.openclaw/workspace/gogcli/bin/gog init

Environment Variables

# Required for gogcli keyring access
export GOG_KEYRING_PASSWORD='your-keyring-password'

# Optional: Path to gogcli binary
export GOG_PATH='~/.openclaw/workspace/gogcli/bin/gog'

gogcli Setup

  1. Run gog init to start OAuth authentication
  2. Complete Google sign-in in your browser
  3. Save the keyring password for future use

Usage

Command Reference

Command Description Example
read-doc <docId> Read document content read-doc 1gBnUjqmmuwlJGxSFwTg8raPqSkJ_qMpf8aciW2Y9Du0
list-docs List all documents list-docs
create-doc <title> Create new document create-doc "My Document"
doc-info <docId> Get document metadata doc-info 1gBnUjqmmuwlJGxSFwTg8raPqSkJ_qMpf8aciW2Y9Du0
download <docId> [path] Download to local path download 1gBnUjqmmuwlJGxSFwTg8raPqSkJ_qMpf8aciW2Y9Du0 ./output
edit-doc <docId> <old> <new> Replace text (creates new doc) edit-doc <id> "old text" "new text"
mark-complete <docId> <task> Mark task complete mark-complete <id> "Configure models"

Examples

Read a document:

node gdocs.js read-doc 1gBnUjqmmuwlJGxSFwTg8raPqSkJ_qMpf8aciW2Y9Du0

Create a new document:

node gdocs.js create-doc "Weekly Meeting Notes"

Find and replace text:

node gdocs.js edit-doc 1gBnUjqmmuwlJGxSFwTg8raPqSkJ_qMpf8aciW2Y9Du0 "TODO" "DONE"

Architecture

gdocs-skill/
├── gdocs.js          # Main skill implementation
├── SETUP_GUIDE.md    # Detailed setup instructions
├── SKILL.md          # OpenClaw skill documentation
├── package.json      # NPM dependencies
├── .gitignore        # Excludes credentials/node_modules
└── README.md         # This file

Dependencies

  • gogcli - Google Workspace CLI tool
  • Node.js built-in modules (fs, path, child_process)

Limitations

Inline Editing

This skill uses gogcli which doesn't support inline Google Docs editing. The workaround workflow is:

  1. Download document via gogcli
  2. Edit content locally
  3. Upload as new document
  4. Share with collaborators

For true inline editing with full formatting support, direct Google Docs API integration with OAuth2 would be required.

Content Preservation

  • Plain text content is preserved
  • Rich formatting may be lost in download/upload cycle
  • Images and complex formatting not fully supported

Security

  • Credentials: Never commit credentials to git
  • Environment Variables: All sensitive data via environment variables
  • Gitignore: Properly excludes credentials/, token.json, and node_modules/

Environment Variables Required

Variable Description
GOG_KEYRING_PASSWORD Password for gogcli keyring access
GOG_PATH Path to gogcli binary (optional)

Troubleshooting

"Keyring not accessible" error

Set the GOG_KEYRING_PASSWORD environment variable:

export GOG_KEYRING_PASSWORD='your-password'

"Document not found" error

  • Verify the document ID is correct
  • Ensure the document is shared with your Google account
  • Check that gogcli is authenticated: gog account

"Permission denied" error

  • Verify Google account has access to the document
  • Check document sharing settings

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make changes
  4. Submit pull request

License

MIT License - see LICENSE file for details.

Credits

  • gogcli - Google Workspace CLI tool
  • OpenClaw - AI assistant framework

About

Google Docs skill for OpenClaw - Direct OAuth integration with Google Docs API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors