1.2.0 • Published 7 months ago
@goobits/gdoc-to-md v1.2.0
🔄 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
- Node.js >= 14.0.0
- Python 3 with pip
- Pandoc for Docs conversion
- Google API credentials (
credentials.json)
🛠️ Setup
1. Install the Package
npm install -g @goobits/gdoc-to-md2. Install Pandoc
# macOS
brew install pandoc
# Ubuntu/Debian
sudo apt install pandoc
# Windows
choco install pandoc3. Get Google API Credentials
- Go to Google Cloud Console
- Enable Google Drive API
- Create OAuth client ID (Desktop app)
- Download as
credentials.json - Use one of these methods:
- Place in your working directory
- Use
--credentials-pathflag - Use
--client-idand--client-secretflags
📋 Usage
Basic
gdoc-to-md /path/to/filesCredentials 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_SECRETOptions
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
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
📄 License
MIT License - see LICENSE file
Made with ❤️ by mudcube
1.2.0
7 months ago