Skip to main content

Load setting value from Google Sheets

Project description

gssetting

PyPI License: MIT

About

gssetting is load setting value from Google Sheets.

Installation

To install gssetting, use pip.

pip install gssetting

Examples

Google Sheets example.

A name empty value
B test1 none value
C test2 ok value ok

Sample code

from dataclasses import dataclass

from gssetting import GoogleSpreadSheetSetting, GSSetting


@dataclass
class Setting(GSSetting):
    username: str
    value: str

    # Same header value of sheets
    headers = ["name", "value"]


if __name__ == "__main__":
    gs_setting = GoogleSpreadSheetSetting(
        "./service_account.json", "document_id"
    )
    settings = gs_setting.load("sheet_name", "A1:C3", Setting)
    print(settings)

    for setting in settings:
        print(setting.username.value)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for gssetting, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size gssetting-0.0.1.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View
Filename, size gssetting-0.0.1-py3-none-any.whl (5.7 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page