1.2.0 • Published 7 months ago

@goobits/gdoc-to-md v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

🔄 GDrive to MD/CSV

Convert Google Drive files to local formats:

  • 📝 Google Docs → Markdown (.md)
  • 📊 Google Sheets → CSV (.csv)

🚀 Quick Start

npm install -g @goobits/gdoc-to-md
gdoc-to-md /path/to/google/drive/files

✨ Features

  • Converts files in-place (next to originals)
  • Preserves directory structure
  • Adds YAML frontmatter to Markdown
  • Handles special characters
  • Detailed conversion reports

⚙️ Prerequisites

  1. Node.js >= 14.0.0
  2. Python 3 with pip
  3. Pandoc for Docs conversion
  4. Google API credentials (credentials.json)

🛠️ Setup

1. Install the Package

npm install -g @goobits/gdoc-to-md

2. Install Pandoc

# macOS
brew install pandoc

# Ubuntu/Debian
sudo apt install pandoc

# Windows
choco install pandoc

3. Get Google API Credentials

  1. Go to Google Cloud Console
  2. Enable Google Drive API
  3. Create OAuth client ID (Desktop app)
  4. Download as credentials.json
  5. Use one of these methods:
    • Place in your working directory
    • Use --credentials-path flag
    • Use --client-id and --client-secret flags

📋 Usage

Basic

gdoc-to-md /path/to/files

Credentials Options

# Default: looks for credentials.json in current directory
gdoc-to-md /path/to/files

# Custom file path
gdoc-to-md /path/to/files --credentials-path ~/.config/gdoc/creds.json

# Inline credentials (no file needed!)
gdoc-to-md /path/to/files --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET

Options

gdoc-to-md --gdoc-only         # Only Google Docs
gdoc-to-md --gsheet-only       # Only Google Sheets
gdoc-to-md --skip-existing     # Skip converted files
gdoc-to-md --keep-intermediates # Keep DOCX files
gdoc-to-md --dry-run           # Preview only
gdoc-to-md --limit 5           # Process first 5 files
gdoc-to-md --credentials-path ~/.config/gdoc/creds.json  # Custom credentials path
gdoc-to-md --client-id YOUR_ID --client-secret YOUR_SECRET  # Inline credentials

📂 Output

Google Docs → Markdown

---
title: "Document Title"
source_doc_id: "google_doc_id"
source_url: "https://docs.google.com/..."
converted_on: "2024-01-15 10:30:00"
---

Your document content in Markdown...

Google Sheets → CSV

Direct CSV export preserving all data and structure.

🔐 Security

  • Read-only Google Drive access
  • Local token storage (token.pickle)
  • Never commit credentials.json
  • Credentials excluded from npm package

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

📄 License

MIT License - see LICENSE file


Made with ❤️ by mudcube