GoogleAPI provides Python integrations for Google Sheets and Google Drive, facilitating access and manipulation of Google Sheets data and Drive files. It aims to simplify workflows involving Google Sheets and pandas, with upcoming features to export pandas DataFrames directly to Google Sheets.
Features
- Access and manipulate Google Sheets via the Sheets API
- Access Google Drive metadata and create folders
- Pythonic interface to Google APIs
- Planned DataFrame to Google Sheet export functionality
Tech Stack
- Python 3
- Google API Client Libraries (
google-api-python-client,google-auth,google-auth-oauthlib)
Getting Started
Prerequisites
- Python 3.x installed
- Google Cloud project with Sheets and Drive APIs enabled
- OAuth 2.0 credentials JSON file (
credentials.json) downloaded from Google Cloud Console
Installation
pip install --upgrade google-api-python-client google-auth google-auth-oauthlib
Usage
- Place your
credentials.jsonfile in the project directory. - Import and instantiate the
GoogleAPIclass:
from GoogleServices import GoogleAPI
google_api = GoogleAPI()
- Use
google_api.SheetsAppandgoogle_api.DriveAppto interact with Sheets and Drive respectively.
Project Structure
GoogleAPI/
├── GoogleServices.py # Main API wrapper classes for Sheets and Drive
├── SheetsApp.py # Sheets and Drive app classes with API calls
└── LICENSE # License file
GoogleServices.pycontains theGoogleAPIclass that initializes credentials and app instances.SheetsApp.pydefinesSheetsAppandDriveAppclasses with methods for Google Sheets and Drive API calls.
Future Work / Roadmap
- Implement
df.togooglesheet()functionality to export pandas DataFrames directly to Google Sheets. - Expand Drive API capabilities beyond metadata reading, including file uploads and downloads.
- Add comprehensive error handling and logging.
- Provide examples and documentation for common use cases.