Skip to main content

Generate data and reports from Google Sheets and Drive

Project description

Google Slides Automator

This repository contains a python package / binary for generating multiple Google Slide reports in Google Drive by copying data from Google sheets. This package can be used to a automate pdf report generation by first modifying placeholders ({{placeholder}}) in a Google Slide with data and converting the slide to a report.

Following elements in a slide can be replaced,

  1. Text placeholders in a paragraph
  2. Charts
  3. Tables
  4. Pictures

The real value of this package is the ability to generate a report for different entities. By providing the raw data for each entity the package in a structure format the code can generate reports for each entitiy automatically.

Getting Started

Requirements to running the reports are:

  1. Python 3.12 or above.
  2. Google Sheets, Slides and Drive API enabled service account credentials.
  3. Access to Google Drive Shared Drive containing slide and data templates and L0 data.

Service Account Setup

  1. Create a service account in Google Cloud Console with the following scopes:
  2. Download the JSON key file and save it as service-account-credentials.json in the project root
  3. Important: Share all required Google Drive files and folders with the service account email (found in the JSON file as client_email) with Editor permissions
    • This includes all folders (L0-Data, L1-Data, output folders)
    • All template files (spreadsheets, presentations)
    • For Shared Drives, add the service account as a member with appropriate permissions

If you see "File not found" errors when trying to delete files, it means the service account doesn't have access to those files. The error messages will include the service account email that needs to be granted access.

How it works

The package works exclusively on Google Drive files only. One of the inputs to the package functions will be a Google Drive folder id. It expects the Google Drive to have the exact structure.

/
├── L0-Raw/
│   ├── entity-1/
│   │   ├── s1-table-performance.csv
│   │   ├── s2-chart-profit.csv
│   │   ├── s3-picture-distribution.png
│   │   └── ...
│   ├── entity-2/
│   │   ├── s1-table-performance.csv
│   │   ├── s2-chart-profit.csv
│   │   ├── s2-picture-distribution.png
│   │   └── ...
│   └── ...
├── L1-Merged/
│   ├── entity-1/
│   │   ├── entity-1.gsheet
│   │   ├── s3-picture-distribution.png
│   ├── entity-2/
│   │   ├── entity-2.gsheet
│   │   ├── s3-picture-distribution.png
│   └── ...
├── L2-Slide/
│   ├── entity-1.gslide
│   ├── entity-2.gslide
│   └── ...
├── L3-Pdf/
│   ├── entity-1.pdf
│   ├── entity-2.pdf
│   └── ...
├── templates/
│   ├── slide-template.gslide
│   ├── data-template.gsheet
│   └── ...
└── entities.csv
  • entities.csv - Two columns: first column is the entity name; the second column generate controls processing. Rows with generate set to Y are processed, while N (or blank) rows are skipped. The first row is treated as a header.

  • templates/ - This folder contains 2 files. A data template gsheet file and a slide template gslide file.

The data template is will have multiple sheets. Each sheet will have the data for a single element (chart/table/picture). One sheet will have data for a element and there can be multiple elements in a sheet.

The main purpose of template is to create charts to be embedded into the Google Slide report.

  • L3-Pdf/: Pdf reports for each entity. These are generated by converting the Google Slide reports to pdf.

  • L2-Slide/: Google Slide reports for each entity. These are generated by copying the slide template and replacing the placeholders with the data from the L1-Data sheet. This folder will have one slide per entity.

  • L1-Merged/: Processed and structured data—one spreadsheet per entity, used to generate charts. This folder will have sub folders for each entity. Each entity folder will have a spreadsheet for each slide and also the pictures used in the slides.

  • L0-Raw/: Raw input data for each entity. This folder will have sub folders for each entity. Each entity folder will have the raw data for each slide and also the pictures used in the slides.

To understand the data better refer to the drive below which contains sample data for a couple of bike dealers.

https://drive.google.com/drive/u/0/folders/1EaaTMa5H6EOuWMom_4iE6RZ51qWYf2af

Why is L0-Raw needed?

Technically if you are able to generate data in the L1-Merged structure you do not need L0-Raw. However, not all languages have good API's to interact with Google Sheets like R. So to be compatible in such scenarios the library provides L0-Raw as just csv files. But if have the ability to generate merged datat for L1, skip L0 data generation.

Steps to use the libary

WIP

Future work

  • Distribute as binary for OSX (brew), Windows (nuget)

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

gslides_automator-0.4.1.tar.gz (38.5 kB view details)

Uploaded Source

Built Distribution

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

gslides_automator-0.4.1-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

Details for the file gslides_automator-0.4.1.tar.gz.

File metadata

  • Download URL: gslides_automator-0.4.1.tar.gz
  • Upload date:
  • Size: 38.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for gslides_automator-0.4.1.tar.gz
Algorithm Hash digest
SHA256 35ce9a5d9cc7be1c535e9b1c9ad8ec4b82614856c76cc0b0f05b60be46b5fb22
MD5 9431d361dfbac9692f789469932a8701
BLAKE2b-256 c2fb65114745de707ec7b9c65b56131aa6f2884fb1358e00f98007f796134753

See more details on using hashes here.

File details

Details for the file gslides_automator-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gslides_automator-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 790f8b72a4b0e3aa92217cad492ced86cb25a2cb333c38f509fa78b687742dd4
MD5 26b3f53a2e874c0e80899503a0042ddd
BLAKE2b-256 b8e2ec605732eb84c537429847eca17cfc50f356bfa9f0c59ab2eb0861424443

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