LlamaIndex Google Readers

raw JSON →
0.7.2 verified Mon Apr 27 auth: no python

A collection of Google data connector readers for LlamaIndex, supporting Google Drive, Gmail, Google Calendar, Google Sheets, and Google Docs. Currently at version 0.7.2, with frequent updates following the LlamaIndex release cadence.

pip install llama-index-readers-google
error ModuleNotFoundError: No module named 'llama_index.readers.google_drive'
cause Import path changed in v0.5.0. Old code uses deprecated path.
fix
Update import to 'from llama_index.readers.google import GoogleDriveReader'
error google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials.
cause Missing or invalid Google credentials. Either OAuth token or service account key not provided.
fix
Set GOOGLE_APPLICATION_CREDENTIALS environment variable to point to a JSON service account key, or run the OAuth flow.
error AttributeError: 'GoogleDriveReader' object has no attribute 'load_data'
cause Likely using a very old version (<0.4.0) where the method was named 'load_documents'.
fix
Upgrade to latest: pip install --upgrade llama-index-readers-google
breaking In v0.5.0, the import paths were restructured. Previously readers were under 'llama_index.readers.google_drive', 'llama_index.readers.gmail', etc. Now all Google readers are under 'llama_index.readers.google'. Update imports accordingly.
fix Change imports to 'from llama_index.readers.google import ...'
deprecated The 'service_account_key_path' parameter in GoogleDriveReader is deprecated in favor of 'credentials'.
fix Use 'credentials' parameter with a GoogleOAuth2Credentials object instead.
gotcha Folder ID for GoogleDriveReader is case-sensitive and must be the folder's ID (not name). Extracting from URL can be error-prone.
fix Use the folder ID from the URL: 'https://drive.google.com/drive/folders/<folder-id>'

Initialize GoogleDriveReader with folder ID and optional service account key. Falls back to OAuth flow if no key provided.

import os
from llama_index.readers.google import GoogleDriveReader

# Set your Google OAuth credentials path or rely on default discovery
reader = GoogleDriveReader(
    folder_id="<your-folder-id>",
    service_account_key_path=os.environ.get("GOOGLE_SERVICE_ACCOUNT_KEY", ""),
)
documents = reader.load_data()