Google Workspace Cli

Google Workspace administration via the gws CLI. Install, authenticate, and automate Gmail, Drive, Sheets, Calendar, Docs, Chat, and Tasks. Run securi

What Is Google Workspace Cli?

Google Workspace Cli is a comprehensive, open-source command-line interface (CLI) for administering and automating tasks across Google Workspace services. Built around the gws command, this tool empowers IT administrators, developers, and productivity-focused teams to interact with Gmail, Drive, Sheets, Calendar, Docs, Chat, Tasks, and more, all from the terminal. Google Workspace Cli consolidates service management, security auditing, and workflow automation behind a unified, scriptable interface—eliminating the need for multiple dashboards or web portals.

The solution is designed for both day-to-day administration and advanced automation. It includes 43 built-in recipes (predefined workflows), 10 persona bundles (role-based command groups), and access to over 18 Google Workspace service APIs. Whether you need to send a Gmail on behalf of a team, schedule a calendar event, audit user permissions, or bulk-manage Drive files, Google Workspace Cli provides expert-level control from any environment that supports Python, Node.js, or Rust.

Why Use Google Workspace Cli?

Google Workspace Cli addresses key pain points in Google Workspace management:

  • Efficiency: Command-line automation saves significant time over manual web-based administration, especially for repetitive or large-scale tasks.
  • Consistency: Scripts and commands ensure repeatable results, reducing human error and improving compliance.
  • Scalability: Bulk operations (e.g., user provisioning, file management) can be executed quickly and reliably.
  • Security: Integrated security audits and policy checks help administrators identify risks and enforce organizational standards.
  • Flexibility: The CLI can be integrated into CI/CD pipelines, cron jobs, or custom automation scripts, supporting both ad hoc and scheduled workflows.
  • Cross-Platform: Available via npm, Cargo, or pre-built binaries, Google Workspace Cli runs on macOS, Linux, and Windows.

For organizations seeking to empower their IT teams or automate Google Workspace at scale, this CLI is a critical addition to the toolkit.

How to Get Started

Installation

Google Workspace Cli offers multiple installation methods tailored to your environment.

Using npm (recommended):

npm install -g @anthropic/gws
gws --version

Using Cargo (from source):

cargo install gws-cli
gws --version

Using Pre-built Binaries: Download the appropriate binary for your OS from github.com/googleworkspace/cli/releases.

Authentication and Setup

To ensure your environment is correctly configured, run the diagnostic script:

python3 scripts/gws_doctor.py

This script checks your PATH, verifies installation, and confirms authentication with Google Workspace. Follow any prompts to complete authentication.

First Commands

Send a Gmail:

gws gmail users.messages send me --to "team@company.com" \
  --subject "Weekly Update" --body "Here's this week's summary..."

List Your Recent Drive Files:

gws drive files list --json --limit 20 | python3 scripts/output_analyzer.py --select "name,mimeType,modifiedTime" --format table

These examples illustrate how quickly you can begin automating routine tasks.

Key Features

  • Multi-Service API Coverage: Access and automate Gmail, Drive, Sheets, Calendar, Docs, Chat, Tasks, and more.
  • Built-in Recipes: Execute 43 curated workflows, such as user onboarding, permission audits, and data exports, with a single command.
  • Persona Bundles: Leverage 10 role-based bundles (e.g., Admin, Auditor, Project Manager) to simplify complex operations.
  • Security Auditing: Run security checks, permission audits, and compliance reports to monitor your Workspace environment.
  • Data Manipulation: List, filter, and transform Google Drive files, manage Calendar events, automate Gmail operations, and update Sheets programmatically.
  • Flexible Output: Pipe JSON results into analyzers or custom scripts for further processing and reporting.
  • Cross-Platform Support: Install and run on any major operating system with minimal dependencies.

Best Practices

  • Script Common Tasks: Store routine commands and scripts in version control, making them reusable and auditable.
  • Use Built-in Recipes: Start with the built-in recipes to automate common workflows; customize as needed before developing bespoke scripts.
  • Integrate with Automation Pipelines: Incorporate gws commands into CI/CD, cron jobs, or IT automation systems to ensure timely and consistent execution.
  • Monitor Security Regularly: Schedule periodic security audits using the CLI to proactively identify risks or permission issues.
  • Leverage Role-Based Bundles: Assign persona bundles to team members according to their job functions, limiting access and reducing the chance of mistakes.
  • Stay Updated: Regularly check for CLI updates to access new features, bug fixes, and security enhancements.

Important Notes

  • Authentication Scope: Google Workspace Cli requires OAuth or service account authentication with appropriate scopes. Ensure least-privilege principles are followed when granting access.
  • Data Privacy: Commands that access or modify user data should be tested in a non-production environment to avoid accidental exposure or loss.
  • Script Safety: Review scripts and command outputs, especially those that perform deletions or bulk updates, before running in production.
  • Compatibility: Some advanced features may require recent versions of Node.js, Python, or Rust. Verify compatibility in your environment.
  • Community Support: As an open-source project, support is community-driven. Consult the GitHub repository for documentation, issues, and contributions.
  • Licensing: Review the open-source license to ensure compliance with organizational policies before wide deployment.

With Google Workspace Cli, organizations can achieve granular control, automation, and auditing of their Google Workspace environment—delivering both productivity and peace of mind for IT and operations teams.