Skip to main content

gsheets3

Conecte seu projeto Django ao Google Sheets de forma simples e eficiente.

gsheets3 é um pacote Python que permite sincronizar modelos Django com planilhas do Google Sheets.
Ideal para quem precisa armazenar ou visualizar dados em tempo real diretamente no Google Sheets, sem complicações.


🔧 Instalação

pip install gsheets3

🚀 Como Usar


1. Configure as credenciais no settings.py:

Adicione o gsheets3 ao INSTALLED_APPS e configure as credenciais do Google Sheets.

INSTALLED_APPS = [
    ...
    'gsheets3',
    ...
]

...

SPERADSHEET_ID = getenv("KEY")

GSHEETS = {
    "service": {
        "private_key": getenv("PRIVATE_KEY"),
        "client_email": getenv("CLIENT_EMAIL"),
        "token_uri": getenv("TOKEN_URI"),
    }
}

2. Inclua a URL no urls.py (do projeto principal):

from django.urls import path, include

urlpatterns = [
    path('', include('gsheets3.urls')),
]

3. Primeira utilização

Antes de usar em seus modelos, faça as migrações do gsheets3 e depois acesse a rota:

/gsheets/cliente/

4. Crie seu modelo com o mixin SheetSyncableMixin:

Somente crie um moledo utilizado o mixins.SheetSyncableMixin após ter conseguido êxito acesasndo a rota /gsheets/cliente/ (vai direto para o admin do django. Tenha um superuser criado (py manage.py createsuperuser))

from django.db import models
from django.conf import settings
from gsheets3 import mixins

class Exemplo(mixins.SheetSyncableMixin, models.Model):
    spreadsheet_id = settings.GSHEETS.get("KEY")
    sheet_name = 'nome do worksheet'

    data_range = 'A1:Z'
    model_id_field = 'id'
    sheet_id_field = 'Django GUID'
    batch_size = 500
    max_rows = 300
    max_col = 'Z'

    Nome = models.CharField(max_length=255)
    Tom = models.CharField(max_length=50)

    def __str__(self):
        return self.Nome

📦 Pré-requisitos



Desenvolvido para facilitar a integração de dados entre seu backend Django e as planilhas do Google! Este pacote foi criado a partir do django-sheets https://pypi.org/project/django-gsheets/

Metadata

Release files for gsheets3 0.1.3

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

Source distribution (sdist)

Source distribution for gsheets3 0.1.3
File Size Uploaded Provenance
gsheets3-0.1.3.tar.gz 17.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for gsheets3 0.1.3
File Interpreter ABI Platform
gsheets3-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 35.5 kB

Release files / gsheets3-0.1.3.tar.gz

Download URL gsheets3-0.1.3.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
83fb5f5413d517cf7b237b8da8564fcf4140303223a7e41454234f7afc136464
BLAKE2b-256 checksum
How to use checksums
570d39f6b66751efc44393779ee72c7b7abd9627130c58ab3703dd77bf353517
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.6 Windows/10

Release files / gsheets3-0.1.3-py3-none-any.whl

Download URL gsheets3-0.1.3-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4168b65df2a70ec1ef940cf4793cac6adbba56c057a6ab5a6daf63bcbfec776
BLAKE2b-256 checksum
How to use checksums
783c2f195342e0e0fa2a490e1ac061e5e4de4812288e98b9e85b02c0312f1b0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.6 Windows/10

Security for gsheets3 0.1.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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