Skip to main content

GSheetz

GSheetz is a small package that I made while trying to connect to the google sheets API. It was really annoying so I made a few classes and functions to make it easier.

The easiest way to use it is through the get_view function and the SheetView class. This package is really for personal use so I'm not going to spend much time on documentation for now, but if the project expands I'll maybe do stuff to make it legible and stuff like that.

Here's some example usage:

from gsheetz.views import SheetView

TOKEN = 'token.json' # Path of token file
SECRET = 'client_secret.json' # Path of client secret file
SCOPES = 'https://www.googleapis.com/auth/spreadsheets' # Scopes variable as defined by API
sheetID = '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms' # Sheet ID
sheetName = 'Class Data'

# SheetView is the default so you don't technically need to import it
view = SheetView.get_view(TOKEN,SECRET,SCOPES)
df = view.view_sheet(sheetID,sheetName)
# View the sheet - This loads the sheet,
# stores it in a pandas DataFrame at view.localdf,
# formats it (if you override the format_sheet method),
# sets view.current = sheetID and view.sheet = sheetName, and then returns the DataFrame

As you can see, the point of this package is to take care of the boiler-plate for you. If you'd like to interact with the API yourself, simply call get_view(TOKEN,SECRET,SCOPES).api to get access to the API object (service.spreadsheets()).

Future Plans (in arbitrary order)

  • Dynamically update the localdf attribute of SheetView objects instead of just 'refreshing' it.
  • Add support for editing multiple ranges
  • Eventually change the architecture for the connection module to use something besides oath2client (it's been deprecated)
  • Add functionality to load a range instead of a whole sheet
  • Write documentation

Sources

  • Google Sheets API - The docs for the API
  • Guide and Quickstart - I literally copy-pasted the python code from this and separated it into multiple functions. I tried figuring out how to use google.auth but figured it wasn't worth the extra time to parse through all the docs when the code is already written for me
  • Google Sheets API for Python Developers - the docs that explain how to use the python methods

Release files for gsheetz 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gsheetz 0.0.2
File Size Uploaded
gsheetz-0.0.2.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gsheetz 0.0.2
File Interpreter ABI Platform
gsheetz-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 24.9 kB

Release files / gsheetz-0.0.2.tar.gz

Download URL gsheetz-0.0.2.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
06f5544167e949bf1600cfa648640872f36d031bd6c936f30641d7e04e013948
BLAKE2b-256 checksum
How to use checksums
98002a15e2c1f48cdcb8b517532586dd77c32e11d197b77bf57408863feee1df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / gsheetz-0.0.2-py3-none-any.whl

Download URL gsheetz-0.0.2-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58a4450cf878b6b7efabf2bff2ce6b203c69ee96e9b48fc3a754aff5b914bffd
BLAKE2b-256 checksum
How to use checksums
10519a108a5b0acc1bf291358b4d30c864f4c83bc521ca5a4ebaf524d117b711
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page