Registry / gcp / spreadsheetbot

spreadsheetbot

JSON →
library2.5.2pypypi✓ verified 80d ago

A Python library to build Telegram bots where the bot logic and data are managed via Google Spreadsheets. Version 2.5.2, actively maintained. Targets Python >= 3.11. Release cadence: irregular.

pip install spreadsheetbot
INSTALL
IMPORT
SIG · SPREADSHEETBOT
S
spreadsheetbot
gcppythonv2.5.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SpreadSheetBot
from spreadsheetbot import SpreadSheetBot
from spreadsheetbot import SpreadsheetBot

Minimal example to start a Telegram bot driven by a Google Spreadsheet. Requires TELEGRAM_BOT_TOKEN environment variable and a service account JSON file.

from spreadsheetbot import SpreadsheetBot from spreadsheetbot import Config # Configure with your Google Sheets ID and credentials config = Config( spreadsheet_id='1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms', credentials_file='service_account.json' ) # Create bot instance bot = SpreadsheetBot(config) # Start polling (uses Telegram bot token from environment TELEGRAM_BOT_TOKEN) bot.run()
Debug
Known issues
gotchaDo not reuse the same spreadsheet ID across multiple bot instances. The library assumes exclusive access for command registration and state management.
fix
Use a separate spreadsheet for each bot instance, or manage data isolation manually.
affects: >=2.0.0
breakingVersion 2.0.0 completely reworked the API. Old code using v1.x classes like 'Bot' and 'SheetManager' will not work. The main class is now 'SpreadsheetBot'.
fix
Upgrade code to use the new API: replace 'from spreadsheetbot import Bot' with 'from spreadsheetbot import SpreadsheetBot' and adjust method calls accordingly.
affects: 2.0.0+
gotchaGoogle service account credentials must have editor access to the spreadsheet. If the bot fails to write, check spreadsheet sharing settings.
fix
Share the spreadsheet with the service account email (found in the JSON credentials file) with 'Editor' role.
affects: all
breakingTelegram bot token must be set via environment variable TELEGRAM_BOT_TOKEN. Previously, some examples passed it directly; that no longer works.
fix
Set the environment variable TELEGRAM_BOT_TOKEN. Remove any direct token parameter from SpreadsheetBot constructor.
affects: >=2.3.0
Upgrade
Version history
2.5.2latest on PyPI · released Jun 23, 2024
Audit
Dependencies
python-telegram-botrequiredTelegram Bot API client
google-authrequiredGoogle API authentication
gspreadrequiredGoogle Sheets API wrapper
pandasoptionalData manipulation
Agent activity
38 hits · last 30 days
node
36
OpenAI (training)
1
Resources
spreadsheetbot — pip install spreadsheetbot · libregistry