Skip to main content

No project description provided

Project description

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


🔗 Links Úteis


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/

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

gsheets3-0.1.3.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gsheets3-0.1.3-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file gsheets3-0.1.3.tar.gz.

File metadata

  • Download URL: gsheets3-0.1.3.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Windows/10

File hashes

Hashes for gsheets3-0.1.3.tar.gz
Algorithm Hash digest
SHA256 83fb5f5413d517cf7b237b8da8564fcf4140303223a7e41454234f7afc136464
MD5 7195ab4f327f891af4d36ef7e335abeb
BLAKE2b-256 570d39f6b66751efc44393779ee72c7b7abd9627130c58ab3703dd77bf353517

See more details on using hashes here.

File details

Details for the file gsheets3-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: gsheets3-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Windows/10

File hashes

Hashes for gsheets3-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b4168b65df2a70ec1ef940cf4793cac6adbba56c057a6ab5a6daf63bcbfec776
MD5 d986c27d7a0604333283ccfaa6e16dcd
BLAKE2b-256 783c2f195342e0e0fa2a490e1ac061e5e4de4812288e98b9e85b02c0312f1b0a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page