Skip to main content

mitol-django-google-sheets-refunds

This is the Open Learning Django Google Sheets library for handling refund requests over Google Sheets

Setup

Before you begin setting up this library make sure you set up mitol-django-google-sheets first. Follow the instructions here.

Once you have mitol-django-google-sheets installed, then:

pip install mitol-django-google-sheets-refunds

In settings.py

INSTALLED_APPS = [
    ...
    "mitol.google_sheets_refunds.apps.GoogleSheetsRefundsApp",
]
MITOL_GOOGLE_SHEETS_REFUNDS_PLUGINS = [
    "ecommerce.plugins.RefundPlugin"
]

In ecommerce/plugins.py

from mitol.google_sheets_refunds.hooks import hookimpl

class RefundPlugin:
    @hookimpl
    def refunds_process_request(refund_request: RefundRequestRow) -> RefundResult:
        # TODO: look up the user/order
        # TODO: mark the order as refunded
        # TODO: unenroll the user

Create your google sheets folder

The structure of the folder should look as the following:

  1. Spreadsheet that contains sheets with 'Refund Form Responses' and the 'Refunds' sheets, that is being processed.
  2. Request Form

Ask a developer for a template folder to copy this structure.

Add settings to your app

Set MITOL_GOOGLE_SHEETS_REFUNDS_REQUEST_WORKSHEET_ID in your .env file. It is required.

Some settings have default values, which you might need to update, if your sheet is different.

Description of settings (in addition to the ones described in mitol-django-google-sheets):

  • MITOL_GOOGLE_SHEETS_REFUNDS_REQUEST_WORKSHEET_ID

    The IDs of the refund and deferral sheets in the change of enrollment spreadsheet. These can be found by opening the spreadsheet, selecting the "Refunds" or "Deferrals" worksheets, and copying down the gid value in the URL.

    Example: https://docs.google.com/spreadsheets/d/<MITOL_GOOGLE_SHEETS_ENROLLMENT_CHANGE_SHEET_ID>/edit#gid=<MITOL_GOOGLE_SHEETS_REFUNDS_REQUEST_WORKSHEET_ID>

  • MITOL_GOOGLE_SHEETS_REFUNDS_PROCESSOR_COL

    The zero-based index of the refund change sheet column that contains the user that processed the row

  • MITOL_GOOGLE_SHEETS_REFUNDS_COMPLETED_DATE_COL

    The zero-based index of the refund change sheet column that contains the row completion date

  • MITOL_GOOGLE_SHEETS_REFUNDS_ERROR_COL

    The zero-based index of the refund change sheet column that contains row processing error messages

  • MITOL_GOOGLE_SHEETS_REFUNDS_SKIP_ROW_COL

    The zero-based index of the refund change sheet column that indicates whether the row should be skipped

  • MITOL_GOOGLE_SHEETS_REFUNDS_FIRST_ROW

    The first row (as it appears in the spreadsheet) of data that our scripts should consider processing in the refund request spreadsheet

Usage

To processing your google sheet with refund requests simply add:

refund_request_handler = RefundRequestHandler()
results = refund_request_handler.process_sheet()

Here are two main ways that we are currently getting our Google Sheets Refunds processed:

  1. Run a management command. For example: ./manage.py process_refund_requests -i "<spreadsheet id>"
  2. Set up a scheduled celery task. For example:
from mitol.google_sheets_refunds.api import RefundRequestHandler
from main.celery import app

@app.task
def process_refund_requests():
    """
    Task to process refund requests from Google sheets
    """
    refund_request_handler = RefundRequestHandler()
    if not refund_request_handler.is_configured():
        log.warning("MITOL_GOOGLE_SHEETS_* are not set")
        return
    refund_request_handler.process_sheet()

Develper setup

For local development setup and testing please follow the instructions Developer Setup here.

Metadata

Release files for mitol-django-google-sheets-refunds 2026.10.30

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

Source distribution (sdist)

Source distribution for mitol-django-google-sheets-refunds 2026.10.30
File Size Uploaded Provenance Actions
mitol_django_google_sheets_refunds-2026.10.30.tar.gz 8.9 kB With provenance Details for mitol_django_google_sheets_refunds-2026.10.30.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mitol-django-google-sheets-refunds 2026.10.30
File Interpreter ABI Platform Actions
mitol_django_google_sheets_refunds-2026.10.30-py3-none-any.whl Python 3 none any Details for mitol_django_google_sheets_refunds-2026.10.30-py3-none-any.whl

Total release size: 24.2 kB

Release files / mitol_django_google_sheets_refunds-2026.10.30.tar.gz

Download URL mitol_django_google_sheets_refunds-2026.10.30.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ab57653fed34032ea69dd0fe7f7198347732066a4385b23dbfda6f8cb23e70e7
BLAKE2b-256 checksum
How to use checksums
0aa965ba41accbd4ba83d331f176acaec93334a83fee07ea94f4cba27f0eced3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / mitol_django_google_sheets_refunds-2026.10.30-py3-none-any.whl

Download URL mitol_django_google_sheets_refunds-2026.10.30-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6eb5ab66ab26f53691391eee0af626c712b1b9c575cc22e2bfe0331fc9587373
BLAKE2b-256 checksum
How to use checksums
72b4e8a2b9bd1a9c524b326413314cd26aece4095ec0d47d0f183c1cfa9787df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for mitol-django-google-sheets-refunds 2026.10.30

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mitol_django_google_sheets_refunds-2026.10.30.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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