No-boilerplate, async and typed Google Sheets access.
Project description
SlySheets for Python
🚧 This library is an early work in progress! Breaking changes may be frequent.
🐍 For Python 3.10+
No-boilerplate, async and typed Google Sheets access. 😋
pip install slysheets
This library does not have full coverage. Currently, the following topics are supported:
- Editing sheet cells
- Reading sheet metadata
You can directly grant user tokens using the command line, covering the whole OAuth 1.0 grant process.
Example usage:
import asyncio
from SlySheets import *
async def main():
auth = OAuth2User.from_files('client.json', 'user.json')
my_sheet = await Sheet(' < your sheet id > ', auth)
print(sheet.title)
# A1 notation
a1 = await sheet['A1']
print(F"Cell A1: {a1}")
# or zero-indexed row/col
first_cell = await sheet[0, 0]
print(F"Cell A1 (again): {first_cell}")
# zero-indexed rows
first_row = await sheet[0]
print(F" | {first_row[0]:8} | {first_row[1]:8} |")
# header-indexed columns
foos = await sheet['Foo'] # list[Any]
print(F"Foos: {foos}")
# slicing and async iterators
async for row in sheet[1:3]:
# index result by header
print(F" | {row['Foo']:8} | {row['Bar']:8} |")
async for row in sheet[3:]:
# or by column
print(F" | {row['A']:8} | {row['B']:8} |")
# append, of course
await sheet.append([0, 'x'])
await sheet.append(Foo=1, Bar='y')
await sheet.delete[-2:]
await sheet.set['Sheet 1!E3']('Hello World!')
# dates
today = await sheet.date_at('D5') # =TODAY()
print(F"It is now {today.isoformat()} (timezone: {sheet.tz})")
asyncio.run(main())
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
SlySheets-0.1.0.tar.gz
(9.3 kB
view details)
Built Distribution
File details
Details for the file SlySheets-0.1.0.tar.gz
.
File metadata
- Download URL: SlySheets-0.1.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61fd2881edbe6e15ace3a26990d946622f6a961320fe0311d3bacd3c172f0b16 |
|
MD5 | d86507f47f37ba5640b8df82bc0642eb |
|
BLAKE2b-256 | c00f3ed7d062406b331be0681e2c2aa228d13439b00725bd31d238c4aa598961 |
File details
Details for the file SlySheets-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: SlySheets-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f196312ef1533596bcbe1ba1a43101e40f4b407241d35063bf1ac1dd2f84550 |
|
MD5 | 2aa7e88c4370c07d7b7243d8164f18ee |
|
BLAKE2b-256 | 60c39528bb8dc3908af168098d9e85225997c2d98ca8238517868b37ceda7c0c |