Skip to main content

A Google Sheets manager for Python

Project description

GSheetManager

GSheetManager is a Python package that provides a convenient interface for managing Google Sheets. It offers features like batch updates, local caching, and automatic worksheet refreshing to optimize interactions with Google Sheets.

Installation

You can install GSheetManager using pip:

pip install gsheet-manager

Requirements

  • Python 3.6+
  • gspread library

Usage

Here's a basic example of how to use GSheetManager:

from gsheet_manager import GSheetManager

# Initialize the manager
manager = GSheetManager('path/to/key_file.json', 'Your Google Sheet Name', 'Your Worksheet Name')

# Use the batch_sync_with_remote decorator for operations
@GSheetManager.batch_sync_with_remote
def update_sheet(manager):
    # Your operations here
    manager._set_buffer_cells(0, 0, "New Value")

# Run your function
update_sheet(manager)

Features

  • Batch updates to minimize API calls
  • Local caching of sheet values
  • Automatic worksheet refreshing
  • Decorator for syncing operations with remote

API Reference

GSheetManager(key_file, doc_name, sheet_name)

Creates a new GSheetManager instance.

  • key_file: Path to your Google Service Account key file
  • doc_name: Name of your Google Sheet
  • sheet_name: Name of the worksheet

Methods

  • refresh_worksheet(): Refreshes the worksheet if the timeout has passed
  • sync_from_remote(): Syncs local values from the remote sheet
  • batch_update_remote(): Sends batched updates to the remote sheet
  • _set_buffer_cells(python_row_idx, python_col_idx, value): Sets a value in the local buffer

Decorators

  • @batch_sync_with_remote: Decorator for methods that need to sync with the remote sheet

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gsheet-manager-0.2.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gsheet_manager-0.2.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file gsheet-manager-0.2.0.tar.gz.

File metadata

  • Download URL: gsheet-manager-0.2.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.17

File hashes

Hashes for gsheet-manager-0.2.0.tar.gz
Algorithm Hash digest
SHA256 df58a431a7b18a4d77b510beb79d329735b7ce83a4195ff8e7c22fdc839d33e3
MD5 4bec8313b7fa31a559822b4e6bfc44f6
BLAKE2b-256 63e835ef15827c5421194c8ed27141c942d00a124359473bdff320551df747c0

See more details on using hashes here.

File details

Details for the file gsheet_manager-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: gsheet_manager-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.17

File hashes

Hashes for gsheet_manager-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 812447f23def39e667f82f8b8c7aec558874ee4e823ec6d67a11eb274b4efcb2
MD5 174590c9d913b6e10b9f463f58784531
BLAKE2b-256 d052a21cf4696bed664f3b26c77d5611c78c73b37737650ed17ae25cf8fdd836

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page