Connect Multiple Google Accounts to Claude Code (Google Workspace CLI)
21:14

Connect Multiple Google Accounts to Claude Code (Google Workspace CLI)

Jonathan Lewell

8 chapters7 takeaways9 key terms5 questions

Overview

This video demonstrates how to overcome the limitations of standard Google connectors in Claude by using the Google Workspace Command Line Interface (CLI). The standard connectors only allow one Google account and have restricted functionality, such as only drafting emails. The Google Workspace CLI, however, enables users to connect multiple Google accounts (Gmail, Drive, Calendar, etc.) and perform a much wider range of actions, including sending emails, creating calendar events, and managing documents and spreadsheets. The tutorial provides a step-by-step guide on installing and configuring the CLI for one or more Google accounts, involving setting up Google Cloud projects, enabling APIs, configuring OAuth consent screens, and authenticating the CLI with your accounts.

How was this?

Save this permanently with flashcards, quizzes, and AI chat

Chapters

  • Standard Google connectors in Claude are limited to a single Google account.
  • Functionality is restricted, e.g., only drafting emails, not sending or replying.
  • These limitations hinder users with multiple email addresses or Google Drive accounts.
Understanding these limitations highlights the need for a more robust solution to effectively manage multiple Google services within Claude.
The Gmail tool only allows drafting emails, preventing direct communication or engagement with existing threads.
  • The Google Workspace CLI offers expanded functionality beyond standard connectors.
  • It allows connecting multiple Google accounts (Gmail, Drive, Calendar, etc.) simultaneously.
  • Users can perform a wider range of actions, such as sending emails and creating calendar events.
This CLI provides a powerful way to integrate and control multiple Google services from Claude, significantly increasing productivity.
The CLI can summarize emails across different inboxes, digest calendar information, create slide decks, and edit spreadsheets.
  • Installation can be initiated by instructing Claude to install the Google Workspace CLI, referencing its GitHub documentation.
  • Claude will ask clarifying questions about desired Google accounts and services.
  • Users need to create a Google Cloud project and enable specific APIs (e.g., Gmail, Drive, Calendar).
Proper installation and project setup are crucial first steps for enabling the CLI's advanced capabilities.
Instructing Claude: 'I would like to install the Google Workspace CLI. Ask me any questions that you may have about doing this. I want to be able to read and write Gmail emails, Google Drive, Google Calendar, etc. and I want to set up multiple accounts. Follow the GitHub link here.'
  • A new Google Cloud project must be created via the Google Cloud console.
  • Required APIs (Gmail, Drive, Calendar, Docs, Sheets, Slides) need to be enabled within the project.
  • This grants the CLI permission to interact with these Google services.
Enabling the correct APIs is essential for the CLI to access and manipulate your Google Workspace data.
Navigating to console.cloud.google.com, creating a new project named 'Google Workspace CLI', and then enabling the Gmail API, Google Drive API, etc.
  • An OAuth consent screen must be configured to authorize access to user data.
  • Test users (your own email addresses) need to be added to the consent screen.
  • A desktop application client is created, and its JSON credentials file is downloaded.
OAuth configuration is a security measure that allows the CLI to securely access your Google account data on your behalf.
Creating a desktop application client named 'GWS CLI', downloading the resulting JSON file, and saving it to the '.config/GWS' directory.
  • The downloaded client secret JSON file is placed in a specific hidden configuration folder.
  • The `gws-cli login` command is run, which prompts for browser-based authentication.
  • Successful authentication confirms the connection to Google services like Drive, Gmail, and Calendar.
This authentication step links your Google account to the CLI, enabling it to perform actions on your behalf.
Running `gws-cli login`, receiving a URL, opening it in a browser, signing into the Google account, and granting permissions.
  • To add another account, repeat the process of creating a new Google Cloud project and enabling APIs for that specific account.
  • Each new account requires its own set of OAuth credentials and a dedicated configuration folder within the CLI's config directory.
  • The CLI automatically creates new subfolders (e.g., 'GWS_Insider_One') for each additional account's credentials.
This systematic approach allows seamless integration and management of multiple distinct Google accounts within the same CLI setup.
Creating a second Google Cloud project ('GWS Insider'), enabling APIs, configuring a new OAuth consent screen, downloading new credentials, and placing them in a new folder like '.config/GWS/Insider_One'.
  • Once configured, the CLI can be used via Claude to perform various tasks across connected accounts.
  • Examples include drafting documents in Google Drive, creating slide decks, and querying calendar events.
  • Users can switch between accounts to manage different services independently.
These practical demonstrations showcase the power and versatility of the Google Workspace CLI for managing diverse Google services.
Asking Claude: 'What Google calendar meetings do I have today at Insider One?' or 'What are my latest three emails that I received at my john@jonathanl.com account?'

Key takeaways

  1. 1The Google Workspace CLI significantly enhances Claude's integration with Google services by overcoming the single-account and limited-functionality restrictions of native connectors.
  2. 2Connecting multiple Google accounts requires setting up separate Google Cloud projects and OAuth credentials for each account.
  3. 3The installation process involves instructing Claude, creating Google Cloud projects, enabling necessary APIs, configuring OAuth consent screens, and authenticating via browser login.
  4. 4Properly organizing downloaded JSON credentials into dedicated folders within the CLI's config directory is essential for managing multiple accounts.
  5. 5The CLI enables advanced actions like sending emails, creating calendar events, and managing documents/spreadsheets directly through Claude.
  6. 6Documenting your connected services (e.g., in a Markdown file) helps Claude understand which CLI to use for specific requests.
  7. 7The Google Workspace CLI offers a more powerful and flexible alternative to the standard Google connectors for users managing multiple Google accounts.

Key terms

Google Workspace CLIClaude ConnectorsGoogle Cloud ProjectAPIs (Application Programming Interfaces)OAuth Consent ScreenClient Secret JSONAuthenticationConfiguration FolderDesktop Application Client

Test your understanding

  1. 1What are the primary limitations of the standard Google connectors within Claude that the Google Workspace CLI addresses?
  2. 2How does the Google Workspace CLI enable the connection and management of multiple Google accounts?
  3. 3What are the essential steps involved in setting up a Google Cloud project for use with the Google Workspace CLI?
  4. 4Why is configuring the OAuth consent screen and adding test users a critical part of the CLI setup process?
  5. 5How can a user verify that the Google Workspace CLI has been successfully installed and authenticated for a specific Google account?

Turn any lecture into study material

Paste a YouTube URL, PDF, or article. Get flashcards, quizzes, summaries, and AI chat — in seconds.

No credit card required