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.1.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.1-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_google_sheets-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 75d50767d7f50f8f8ad518ce502c03d17043321318191dc4fa6b4c9eb189a1e1
MD5 8a38ecc67dd0995ddaf5739105f95c51
BLAKE2b-256 e0d2ef128233dc4f8fa1ceaa6e46994190d5e5b025522a79405c373adff28195

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_google_sheets-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae9b1061b7e289f480ea48b0db40e0cb957d15ad2912d7fc513f49d0ebfff24d
MD5 018685d56289b0ec075a7fa4f12d1c9c
BLAKE2b-256 392579268de1b43ec7ba54910b07f2c0117068995f9dbbfe41c718a4d522f66a

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