Skip to main content

The most efficient Python wrapper for Google Sheets API

Project description

Google Sheets API Python wrapper

Built for developers who want to interact with Google Sheets API in a little more simple way while maintaining peak efficiency.

Installation

pip install python-google-sheets

Usage

from google_sheets import GoogleSheets, ApiRequest, CellFormat, TextFormat, TextRotation, Color_

SPREADSHEET_ID = 'your_spreadsheet_id'
SHEET_ID = 0
service = GoogleSheets.build_service(path_to_creds='your_service_account_creds.json')  # 'service_account.json' is used by default

# Update data
api_requests = [
    ApiRequest.update_cells(SHEET_ID, range_='A1:B2', values=[['Bold', 'Italic'], ['Underlined', 'Rotated']]),
    ApiRequest.update_cells(SHEET_ID, range_='A1:B2', cell_formats=[
        [CellFormat(text_format=TextFormat(bold=True)), CellFormat(text_format=TextFormat(italic=True))],
        [CellFormat(text_format=TextFormat(underline=True)), CellFormat(text_rotation=TextRotation(angle=10))],
    ]),
    ApiRequest.update_cells(SHEET_ID, range_='A4:C4', values=['Row', 'of', 'data']),
    ApiRequest.update_cells(SHEET_ID, range_='B6:B8', values=['Column', 'of', 'data']),
    ApiRequest.update_cells(SHEET_ID, range_='A10:C10', values=['This', 'text', 'is colored'], cell_formats=[
        CellFormat(background_color_style=Color_.Basic.YELLOW),
        CellFormat(background_color_style=Color_.Basic.DARK_ORANGE_2),
        CellFormat(background_color_style=Color_.Basic.PLACE_2_10),
    ])
]
GoogleSheets.update_spreadsheet(SPREADSHEET_ID, api_requests=api_requests, service=service)

# Obtain data
values = GoogleSheets.get_spreadsheet_range_values(SPREADSHEET_ID, sheet=SHEET_ID, ranges=['A1:C10'])

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

python_google_sheets-0.1.2.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_google_sheets-0.1.2-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file python_google_sheets-0.1.2.tar.gz.

File metadata

  • Download URL: python_google_sheets-0.1.2.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for python_google_sheets-0.1.2.tar.gz
Algorithm Hash digest
SHA256 08c577e1f0b81bcdf5692c7cb658ce13f6b3d32f74ed32f9d9f914c60f22bbf3
MD5 03be4ee66fc1bf52776f2007030815f8
BLAKE2b-256 c0bf1e553d30e5f29bf78805ab20e035b09e612d106bc1ea0fb1de3ebe5294e3

See more details on using hashes here.

File details

Details for the file python_google_sheets-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python_google_sheets-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4a9b1e9248d26f33f7d0e574a2ee3f6abd09183f10c1731df20a21316efc9e7e
MD5 8d5b0ce461f90dfc67ad93347195c780
BLAKE2b-256 6de135d6ede5d0bb46904fa043fd0ee2ea5a1b74bbbfac5b6482c0c23da31cec

See more details on using hashes here.

Supported by

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