A small package for accessing the google sheets API.
Project description
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 ofSheetView
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gsheetz-0.0.2.tar.gz
.
File metadata
- Download URL: gsheetz-0.0.2.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06f5544167e949bf1600cfa648640872f36d031bd6c936f30641d7e04e013948 |
|
MD5 | 4acb5e0b6de566fa0dca476305a35986 |
|
BLAKE2b-256 | 98002a15e2c1f48cdcb8b517532586dd77c32e11d197b77bf57408863feee1df |
File details
Details for the file gsheetz-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: gsheetz-0.0.2-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58a4450cf878b6b7efabf2bff2ce6b203c69ee96e9b48fc3a754aff5b914bffd |
|
MD5 | 69bae7bc2ff23415ea63bf6c75f721aa |
|
BLAKE2b-256 | 10519a108a5b0acc1bf291358b4d30c864f4c83bc521ca5a4ebaf524d117b711 |