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:

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.2.tar.gz (17.4 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.2-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gsheets3-0.1.2.tar.gz
  • Upload date:
  • Size: 17.4 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.2.tar.gz
Algorithm Hash digest
SHA256 af8d55fb628ca44483b0dee8709b3d67cb0a81000e32ad5a6c9b1e27488923e1
MD5 7e4145e4dce277bc7db19492d2b201d0
BLAKE2b-256 ec6c6c6a990383b99b4b3d1c677b8df87889cdc17d4b90586a7a120ad6bf3aa9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gsheets3-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 07afc069b90103dbe4d49e863af4290a6c1d3c7eb3441ae4c83a272e341d395a
MD5 091d56ceae7aae890d50b4b49a8b4462
BLAKE2b-256 641030ae435198f17f757ee102ebaa2e09aed4678526244c16976bfd900c992a

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