Skip to main content

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

Release files for prefect-google-sheets 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prefect-google-sheets 0.1.1
File Size Uploaded
prefect-google-sheets-0.1.1.tar.gz 28.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prefect-google-sheets 0.1.1
File Interpreter ABI Platform
prefect_google_sheets-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.8 kB

Release files / prefect-google-sheets-0.1.1.tar.gz

Download URL prefect-google-sheets-0.1.1.tar.gz
Size 28.2 kB
Tags Source
SHA-256 checksum
How to use checksums
21af6044c0c0677591e0b7fe1b54ddff62357aadd9ac79e7d1e458da62bd3d72
BLAKE2b-256 checksum
How to use checksums
93eabf7562746899dda372d179f0a6ef51ac919d32cd53ed70bc529175090550
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release files / prefect_google_sheets-0.1.1-py3-none-any.whl

Download URL prefect_google_sheets-0.1.1-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24dacc4a5ceacee0c3b6daf31f242a61bd263089b231c22db6a4f02d74228c60
BLAKE2b-256 checksum
How to use checksums
cfdb27e905f41fc4f8d7412ccd2da3112b7d9ea14acd556e1e5513846bcfc47b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page