Skip to main content

Prefect collection of tasks in order to work with Google Sheets

Project description

prefect-google-sheets

PyPI

Welcome!

Prefect collection of tasks in order to work with Google Sheets

Getting Started

Python setup

Requires an installation of Python 3.7+.

We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.

These tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the Prefect documentation.

Installation

Install prefect-google-sheets with pip:

pip install prefect-google-sheets

Then, register to view the block on Prefect Cloud:

prefect block register -m prefect_google_sheets

Note, to use the load method on Blocks, you must already have a block document saved through code or saved through the UI.

Write and run a flow

from prefect import flow
from prefect_google_sheets.tasks import (
    read_google_sheet_as_data_frame,
    read_google_sheet_as_list_of_lists,
    read_google_sheet_as_dict_of_lists,
)


@flow
def read_sheets():
    sheet_df = read_google_sheet_as_data_frame(
        is_public_sheet="<True or False, depending if the sheet you are reading is public or not>",
        google_service_account="<The Google Service Account information in order to access the sheet>",
        google_sheet_key="<The key of the sheet to read>",
        google_sheet_name="<The name of the sheet to read>",
        first_row_header="<True or False, depending if the first row of the table needs to be considered as the header>",
        on_bad_lines="<What to do if bad lines are discovered while reading the sheet>",
        clean="<True or False, depending if blank columns and rows need to be removed>"
    )

    sheet_list_of_lists = read_google_sheet_as_list_of_lists(
        is_public_sheet="<True or False, depending if the sheet you are reading is public or not>",
        google_service_account="<The Google Service Account information in order to access the sheet>",
        google_sheet_key="<The key of the sheet to read>",
        google_sheet_name="<The name of the sheet to read>",
        first_row_header="<True or False, depending if the first row of the table needs to be considered as the header>",
        on_bad_lines="<What to do if bad lines are discovered while reading the sheet>",
        clean="<True or False, depending if blank columns and rows need to be removed>"
    )

    sheet_dict_of_lists = read_google_sheet_as_dict_of_lists(
        is_public_sheet="<True or False, depending if the sheet you are reading is public or not>",
        google_service_account="<The Google Service Account information in order to access the sheet>",
        google_sheet_key="<The key of the sheet to read>",
        google_sheet_name="<The name of the sheet to read>",
        first_row_header="<True or False, depending if the first row of the table needs to be considered as the header>",
        on_bad_lines="<What to do if bad lines are discovered while reading the sheet>",
        clean="<True or False, depending if blank columns and rows need to be removed>"
    )

read_sheet_as_dataframe()

For more tips on how to use tasks and flows in a Collection, check out Using Collections!

Resources

If you encounter any bugs while using prefect-google-sheets, feel free to open an issue in the prefect-google-sheets repository.

If you have any questions or issues while using prefect-google-sheets, you can find help in either the Prefect Discourse forum or the Prefect Slack community.

Feel free to ⭐️ or watch prefect-google-sheets for updates too!

Development

If you'd like to install a version of prefect-google-sheets for development, clone the repository and perform an editable install with pip:

git clone https://github.com/stefanocascavilla/prefect-google-sheets.git

cd prefect-google-sheets/

pip install -e ".[dev]"

# Install linting pre-commit hooks
pre-commit install

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

prefect-google-sheets-0.1.1.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

prefect_google_sheets-0.1.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file prefect-google-sheets-0.1.1.tar.gz.

File metadata

  • Download URL: prefect-google-sheets-0.1.1.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for prefect-google-sheets-0.1.1.tar.gz
Algorithm Hash digest
SHA256 21af6044c0c0677591e0b7fe1b54ddff62357aadd9ac79e7d1e458da62bd3d72
MD5 a3f441c2f77451a052b7023f5de2358a
BLAKE2b-256 93eabf7562746899dda372d179f0a6ef51ac919d32cd53ed70bc529175090550

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prefect_google_sheets-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24dacc4a5ceacee0c3b6daf31f242a61bd263089b231c22db6a4f02d74228c60
MD5 51c37efa92167809a355edbc9ee47d17
BLAKE2b-256 cfdb27e905f41fc4f8d7412ccd2da3112b7d9ea14acd556e1e5513846bcfc47b

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