Google Docs Tools
Overview
Section titled “Overview”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.
Installation
Section titled “Installation”These tools require additional dependencies. Install
with the gdocs extra:
uv tool install 'claude-code-tools[gdocs]'First-Time Setup
Section titled “First-Time Setup”-
Go to Google Cloud Console
-
Create or select a project and enable the Google Drive API and the Google Docs API
-
Go to APIs & Services > Credentials > Create Credentials > OAuth client ID
-
Choose Desktop app, then download the JSON file
-
Save it as
.gdoc-credentials.jsonin your project directory -
First run will open a browser for OAuth consent (one-time per project)
Upload Markdown files as native Google Docs:
# Upload to root of Drivemd2gdoc report.md
# Upload to a specific foldermd2gdoc report.md --folder "Perf/Reports"
# Upload with a custom namemd2gdoc report.md --name "Q4 Summary"Conflict Handling
Section titled “Conflict Handling”If a file with the same name already exists,
--on-existing controls behavior:
ask(default) — prompt for actionversion— auto-add suffix (report-1,report-2, etc.)overwrite— replace existing file
md2gdoc report.md --on-existing overwriteFeatures
Section titled “Features”- Native markdown conversion (same quality as manual upload + “Open in Docs”)
- Image upload — local images referenced in
markdown (e.g.
) are uploaded to Drive at full resolution, then inserted into the Google Doc with proper sizing --max-image-widthcontrols display width in inches (default: 6.5 = full page width)--no-imagesskips image processing entirely- Follows Drive shortcuts to shared folders
- Creates folders if they do not exist
Download Google Docs as Markdown files:
# Download from rootgdoc2md "My Document"
# Download from a specific foldergdoc2md "My Document" --folder "PNL/Reports"
# Save with a custom namegdoc2md "My Document" -o report.md
# List docs in a foldergdoc2md --list --folder PNLImage Handling
Section titled “Image Handling”By default, embedded images are extracted to local
files (e.g. report_001.png, report_002.png)
alongside the markdown, with references rewritten
to use local paths.
- Default — extract images to files
--no-images— strip images to placeholders--keep-base64— keep base64 data inline
See Also
Section titled “See Also”- Google Sheets Tools — upload CSV to Sheets and download Sheets as CSV, using the same OAuth credentials