Skip to main content

Google spreadsheet create/update util

Project description

Author: Pahaz Blinov

Repo: https://github.com/pahaz/google-spreadsheets-api/

Simple create/append google spreadsheet api helper.

Requirements

Installation

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 and run:

python setup.py install

Usage scenarios

Two typical usecases where google_spreadsheet is helpful there are: 1. create new spreadsheet with restricted acccess rules, 2. append data to existing spreadsheet.

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.

Usage examples

Example 1: create spreadsheet

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=['pahaz.blinov@gmail.com'])
    print(sheet)

if __name__ == '__main__':
    create_example()

Example 2: append row to existing spreadsheet

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()

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

google_spreadsheet-0.0.4.tar.gz (6.0 kB view details)

Uploaded Source

File details

Details for the file google_spreadsheet-0.0.4.tar.gz.

File metadata

File hashes

Hashes for google_spreadsheet-0.0.4.tar.gz
Algorithm Hash digest
SHA256 67c168c8ba61d1727a569f70e4a70aae24a0fc13c19d73e783faebde29d34cb0
MD5 71d21a983646ba6a7dc2361cb8bae2b2
BLAKE2b-256 4740a26fa7c8aa6d4fcbf1f890770858965b0589e852dd10e9b91d62ed0e2853

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page