Skip to main content

Tiny Python client for the Sheetson API (Google Sheets as a REST API)

Project description

pysheetson

A tiny Python client for the Sheetson API - Transform any Google Sheet into a REST API.

What is Sheetson?

Sheetson allows you to use Google Sheets as a database for your applications. Every Google Sheet becomes a database, and each tab becomes a table. No complex setup required!

Features

  • CRUD Operations: Create, Read, Update, Delete rows
  • Advanced Filtering: Use where clauses with operators ($gte, $lte, $in, etc.)
  • Sorting & Pagination: Order results and paginate through large datasets
  • Batch Operations: Perform multiple operations efficiently
  • DataFrame Support: Direct integration with pandas DataFrames
  • Type Hints: Full typing support for better development experience
  • Error Handling: Comprehensive error handling with custom exceptions

Quick Start

1. Setup Your Google Sheet

  1. Create a Google Sheet with headers in the first row
  2. Share it with google@sheetson.com as an Editor
  3. Get your API key from Sheetson Dashboard

2. Install pysheetson

pip install requests
# Optional: for DataFrame support  
pip install pandas

3. Start Coding

from pysheetson import SheetsonClient

# Initialize client
client = SheetsonClient(
    api_key="your_api_key_here",
    spreadsheet_id="your_spreadsheet_id_here"
)

# Basic operations
cities = client.list_rows("Cities", limit=10)
new_city = client.create_row("Cities", {"name": "Paris", "country": "France"})
client.update_row("Cities", 2, {"population": "2161000"})
client.delete_row("Cities", 3)

# Advanced filtering
large_cities = client.search_rows("Cities", 
    where={"population": {"$gte": "1000000"}},
    order_by="population", 
    desc=True
)

# Batch operations
operations = [
    {"operation": "create", "data": {"name": "Tokyo", "country": "Japan"}},
    {"operation": "update", "row_number": 2, "data": {"population": "37400068"}},
    {"operation": "delete", "row_number": 5}
]
result = client.batch_operations("Cities", operations)

# DataFrame integration (requires pandas)
import pandas as pd
df = pd.DataFrame([
    {"name": "London", "country": "UK"},
    {"name": "Berlin", "country": "Germany"}
])
client.create_rows_from_dataframe("Cities", df)

Documentation

Examples

Check out the examples/ directory for more usage patterns:

  • quickstart.py - Basic operations
  • batch_and_dataframe_example.py - Advanced features

Error Handling

from pysheetson import SheetsonError

try:
    result = client.create_row("Cities", {"name": "Test"})
except SheetsonError as e:
    print(f"API Error: {e}")

Development

# Clone the repository
git clone https://github.com/Mr-KAM/pysheetson.git
cd pysheetson

# Install in development mode
pip install -e .

# Run tests
python -m pytest tests/

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.

Links

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

pysheetson-0.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

pysheetson-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file pysheetson-0.1.0.tar.gz.

File metadata

  • Download URL: pysheetson-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pysheetson-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8baf74da3d3c60d2b096b236f635b19c8dac47790b0ef6038c1acde5f8ae74dc
MD5 46da343b11f91c00108e505722f37400
BLAKE2b-256 64549abc75487742f0ea6451d7789acb263e127f73159da239c627582f4dc054

See more details on using hashes here.

File details

Details for the file pysheetson-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pysheetson-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pysheetson-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14f284ddd7ae872deea548471ee995d358a2ee91388856a6054e06eba75ddc28
MD5 6f2ecd00ce0f1f01aab3a78d1e14e229
BLAKE2b-256 28a5d31b8f83aeb79d5c6c0a1b580f5025ce790e20ce0e1b2cd5b17026936749

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