Simple helper for google spreadsheet api
MIT License
Author: Pahaz Blinov
_
Repo: https://github.com/pahaz/google-spreadsheets-api/
Simple create/append google spreadsheet api helper.
oauth2client
_googleapiclient
_google_spreadsheet
_ is on PyPI, so simply run:
::
pip install google_spreadsheet
or ::
easy_install google_spreadsheet
to have it installed in your environment.
For installing from source, clone the
repo <https://github.com/pahaz/google-spreadsheets-api>
_ and run::
python setup.py install
Two typical usecases where google_spreadsheet
is helpful there are:
You can use it for export your user data to the google spreadsheet. And sharing this data to all around the world or sharing to specific users.
.. code-block:: py
from google_spreadsheet import get_credentials, Spreadsheets
def create_example():
credentials = get_credentials('auth.json', [
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/spreadsheets'])
api = Spreadsheets(credentials=credentials)
sheet = api.create('test1', writers=['[email protected]'])
print(sheet)
if __name__ == '__main__':
create_example()
.. code-block:: py
from google_spreadsheet import get_credentials, Spreadsheets
def append_data_example():
credentials = get_credentials('auth.json', [
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/spreadsheets'])
api = Spreadsheets(credentials=credentials)
sheet = api.get('1jSHsmPTOOiPXdYQlrVBwbo3MO1vp64lmi5R_Ld_duKo')
sheet.append([[1, 2], [3, 4]])
if __name__ == '__main__':
append_data_example()
.. _Pahaz Blinov: https://github.com/pahaz/ .. _oauth2client: https://github.com/google/oauth2client/ .. _googleapiclient: https://github.com/google/google-api-python-client/ .. _google_spreadsheet: https://pypi.python.org/pypi/google_spreadsheet/