Skip to content

Google Docs Tools

When working with CLI agents like Claude Code on writing projects, the most natural generation format is Markdown. But iterating on those docs via Google Docs is painful — uploading a Markdown file to Google Drive with proper formatting requires multiple manual steps.

md2gdoc reduces this to one command. gdoc2md does the reverse.

These tools require additional dependencies. Install with the gdocs extra:

Terminal window
uv tool install 'claude-code-tools[gdocs]'
  1. Go to Google Cloud Console

  2. Create or select a project and enable the Google Drive API and the Google Docs API

  3. Go to APIs & Services > Credentials > Create Credentials > OAuth client ID

  4. Choose Desktop app, then download the JSON file

  5. Save it as .gdoc-credentials.json in your project directory

  6. First run will open a browser for OAuth consent (one-time per project)

Upload Markdown files as native Google Docs:

Terminal window
# Upload to root of Drive
md2gdoc report.md
# Upload to a specific folder
md2gdoc report.md --folder "Perf/Reports"
# Upload with a custom name
md2gdoc report.md --name "Q4 Summary"

If a file with the same name already exists, --on-existing controls behavior:

  • ask (default) — prompt for action
  • version — auto-add suffix (report-1, report-2, etc.)
  • overwrite — replace existing file
Terminal window
md2gdoc report.md --on-existing overwrite
  • Native markdown conversion (same quality as manual upload + “Open in Docs”)
  • Image upload — local images referenced in markdown (e.g. ![alt](diagram.png)) are uploaded to Drive at full resolution, then inserted into the Google Doc with proper sizing
  • --max-image-width controls display width in inches (default: 6.5 = full page width)
  • --no-images skips image processing entirely
  • Follows Drive shortcuts to shared folders
  • Creates folders if they do not exist
  • Google Sheets Tools — upload CSV to Sheets and download Sheets as CSV, using the same OAuth credentials