ThinkcellBuilder


NameThinkcellBuilder JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/Philistino/ThinkcellBuilder
SummarySimple unofficial Python library for generating PowerPoint presentations using Think-cell
upload_time2022-12-04 17:14:16
maintainer
docs_urlNone
authorPhilistino
requires_python>=3.7
licenseMIT
keywords automation powerpoint thinkcell ppttc business consulting
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ThinkcellBuilder 📊
[![CI](https://github.com/philistino/thinkcellbuilder/actions/workflows/main.yml/badge.svg)](https://github.com/philistino/thinkcellbuilder/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/philistino/thinkcellbuilder/branch/main/graph/badge.svg?token=F71I6S66YW)](https://codecov.io/gh/philistino/thinkcellbuilder) [![PyPI version shields.io](https://img.shields.io/pypi/v/thinkcellbuilder.svg)](https://pypi.python.org/pypi/thinkcellbuilder/) [![Supported Python versions](https://img.shields.io/pypi/pyversions/thinkcellbuilder.svg)](https://pypi.org/project/thinkcellbuilder/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black) [![Downloads](https://pepy.tech/badge/thinkcellbuilder/month)](https://pepy.tech/project/thinkcellbuilder) [![GitHub license](https://img.shields.io/github/license/philistino/thinkcellbuilder.svg)](https://github.com/philistino/thinkcellbuilder/blob/main/LICENSE) 

ThinkcellBuilder is a simple unofficial Python library used to build powerpoint presentations with Think-cell charts, textboxes, and tables. 

This project builds on [Duerto](https://github.com/duarteocarmo)'s [think-cell](https://github.com/duarteocarmo/think-cell) package. 

ThinkcellBuilder allows the user to automate data entry for all named Think-cell objects (e.g., charts, textfields, tables), except Gantt charts, on a powerpoint template. It also provides a presentation abstraction so that one can create a whole presentation using combinations of slide templates and charts.

This package outputs .ppttc files that, when opened with Think-cell, build powerpoint presentations. A [think-cell license and installation](https://www.think-cell.com/en/) license is not required to use this package, but one is needed to build the presentation. Pptc files are just 

### Installation

ThinkcellBuilder is available on PyPi. 

```sh
 $ pip install thinkcellbuilder
 ```

### Tutorial and usage

Let us say you have generated a template according to [think-cell's automation guidelines](https://www.think-cell.com/en/support/manual/jsondataautomation.shtml) called `simple-template.pptx` with the following chart called `Chart1`: 

<!-- <img src="https://raw.githubusercontent.com/duarteocarmo/think-cell/main/assets/example.png" width="500"> -->

The thinkcell library helps you generate a `.ppttc` file so that you can generate presentations based on that template using python:

```python
from thinkcellbuilder import Presentation, Template

# create a presentation object
presentation = Presentation()

# create template object, this usually represents one or a small number of slides
slide1 = Template("Company Performance Template.pptx")
# add your text field
slide1.add_textfield(
    name="Slide Title",
    text="Company Performance",
)
# add data for a chart named Chart1
slide1.add_chart(
    name="Chart1",
    categories=["Ads", "Revenue", "Losses"],
    data=[["Amazon", 1, 11, 14], ["Slack", 8, 2, 15], ["Uber", 1, 2, 12]],
)

# add slide1 to the presentation
presentation.add_template(slide1)

# create another slide from a different template
slide2 = Template("Company Forecast Template.pptx")
# add a text field
slide2.add_textfield(
    name="Slide Title",
    text="Tech Forecasts",
)
# add data for a chart named Chart1
slide2.add_chart(
    name="Chart1",
    categories=["3yr", "5yr", "10yr"],
    data=[["Amazon", 3, 10, 17], ["Slack", 8, 12, 15], ["Uber", 1, 2, 3]],
)

# add slide2 to the presentation
presentation.add_template(slide2)

# save the ppttc file 
presentation.save_ppttc(path="simple-example.ppttc")
 ```

Once done, go ahead and double click the generated `simple-example.ppttc` file. Think-cell will populate your charts/text fields based on the code above and open a powerpoint presentation. Save it and you are done!

You can also derive your chart from a Pandas dataframe. 

Make sure you have pandas installed (e.g., `pip install pandas`)

```python
from thinkcellbuilder import Presentation, Template
import pandas as pd

df = pd.DataFrame(
    columns=["Company", "Ads", "Revenue", "Losses"],
    data=[["Amazon", 1, 11, 14], ["Slack", 8, 2, 15], ["Ford", 1, 2, 12]],
)

slide = Template("simple-template.pptx") # create template object
slide.add_chart_from_dataframe(
    name="Chart1",
    dataframe=df,
) # add your dataframe

presentation = Presentation()
presentation.add_template(slide)
tc.save_ppttc(path="simple-example.ppttc")
 ```

Visit the [examples folder](examples) for more examples and source files. 

If you wish to learn more about this process, visit the think-cell [automation documentation](https://www.think-cell.com/en/support/manual/jsondataautomation.shtml). 

## Dependencies
ThinkcellBuilder has no dependencies outside the Python standard library. If you want to create charts from pandas dataframes, pandas is obviously needed.

## Limitations
It is currently impossible to derive the types or names of Think-cell objects (e.g., charts, named textfields, etc.) in a template programatically, so all automation methods rely on typo-free expression of object names. Mis-typed chart names are silently ignored by Think-cell when it is building the presentation, so please double check your object names and types. 

## Contributing

Start by forking this repo.


Install the development dependencies (you probably want to do this in a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/)):

```shell
 $ pip install -r requirements-dev.txt
 ```

Make sure the tests run:

```shell
 $ pytest
 ```

Create a branch and submit a pull request. 


*Note: This project is in no way affiliated with think-cell Sales GmbH & Co. KG. I just wanted to make my (and hopefully your) life easier.*


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Philistino/ThinkcellBuilder",
    "name": "ThinkcellBuilder",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "automation powerpoint thinkcell ppttc business consulting",
    "author": "Philistino",
    "author_email": "philistino@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/84/04/7e80c2385b4544744abac4e234d880db56576175e984db3ab0875a842f35/ThinkcellBuilder-0.1.0.tar.gz",
    "platform": null,
    "description": "# ThinkcellBuilder \ud83d\udcca\n[![CI](https://github.com/philistino/thinkcellbuilder/actions/workflows/main.yml/badge.svg)](https://github.com/philistino/thinkcellbuilder/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/philistino/thinkcellbuilder/branch/main/graph/badge.svg?token=F71I6S66YW)](https://codecov.io/gh/philistino/thinkcellbuilder) [![PyPI version shields.io](https://img.shields.io/pypi/v/thinkcellbuilder.svg)](https://pypi.python.org/pypi/thinkcellbuilder/) [![Supported Python versions](https://img.shields.io/pypi/pyversions/thinkcellbuilder.svg)](https://pypi.org/project/thinkcellbuilder/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black) [![Downloads](https://pepy.tech/badge/thinkcellbuilder/month)](https://pepy.tech/project/thinkcellbuilder) [![GitHub license](https://img.shields.io/github/license/philistino/thinkcellbuilder.svg)](https://github.com/philistino/thinkcellbuilder/blob/main/LICENSE) \n\nThinkcellBuilder is a simple unofficial Python library used to build powerpoint presentations with Think-cell charts, textboxes, and tables. \n\nThis project builds on [Duerto](https://github.com/duarteocarmo)'s [think-cell](https://github.com/duarteocarmo/think-cell) package. \n\nThinkcellBuilder allows the user to automate data entry for all named Think-cell objects (e.g., charts, textfields, tables), except Gantt charts, on a powerpoint template. It also provides a presentation abstraction so that one can create a whole presentation using combinations of slide templates and charts.\n\nThis package outputs .ppttc files that, when opened with Think-cell, build powerpoint presentations. A [think-cell license and installation](https://www.think-cell.com/en/) license is not required to use this package, but one is needed to build the presentation. Pptc files are just \n\n### Installation\n\nThinkcellBuilder is available on PyPi. \n\n```sh\n $ pip install thinkcellbuilder\n ```\n\n### Tutorial and usage\n\nLet us say you have generated a template according to [think-cell's automation guidelines](https://www.think-cell.com/en/support/manual/jsondataautomation.shtml) called `simple-template.pptx` with the following chart called `Chart1`: \n\n<!-- <img src=\"https://raw.githubusercontent.com/duarteocarmo/think-cell/main/assets/example.png\" width=\"500\"> -->\n\nThe thinkcell library helps you generate a `.ppttc` file so that you can generate presentations based on that template using python:\n\n```python\nfrom thinkcellbuilder import Presentation, Template\n\n# create a presentation object\npresentation = Presentation()\n\n# create template object, this usually represents one or a small number of slides\nslide1 = Template(\"Company Performance Template.pptx\")\n# add your text field\nslide1.add_textfield(\n    name=\"Slide Title\",\n    text=\"Company Performance\",\n)\n# add data for a chart named Chart1\nslide1.add_chart(\n    name=\"Chart1\",\n    categories=[\"Ads\", \"Revenue\", \"Losses\"],\n    data=[[\"Amazon\", 1, 11, 14], [\"Slack\", 8, 2, 15], [\"Uber\", 1, 2, 12]],\n)\n\n# add slide1 to the presentation\npresentation.add_template(slide1)\n\n# create another slide from a different template\nslide2 = Template(\"Company Forecast Template.pptx\")\n# add a text field\nslide2.add_textfield(\n    name=\"Slide Title\",\n    text=\"Tech Forecasts\",\n)\n# add data for a chart named Chart1\nslide2.add_chart(\n    name=\"Chart1\",\n    categories=[\"3yr\", \"5yr\", \"10yr\"],\n    data=[[\"Amazon\", 3, 10, 17], [\"Slack\", 8, 12, 15], [\"Uber\", 1, 2, 3]],\n)\n\n# add slide2 to the presentation\npresentation.add_template(slide2)\n\n# save the ppttc file \npresentation.save_ppttc(path=\"simple-example.ppttc\")\n ```\n\nOnce done, go ahead and double click the generated `simple-example.ppttc` file. Think-cell will populate your charts/text fields based on the code above and open a powerpoint presentation. Save it and you are done!\n\nYou can also derive your chart from a Pandas dataframe. \n\nMake sure you have pandas installed (e.g., `pip install pandas`)\n\n```python\nfrom thinkcellbuilder import Presentation, Template\nimport pandas as pd\n\ndf = pd.DataFrame(\n    columns=[\"Company\", \"Ads\", \"Revenue\", \"Losses\"],\n    data=[[\"Amazon\", 1, 11, 14], [\"Slack\", 8, 2, 15], [\"Ford\", 1, 2, 12]],\n)\n\nslide = Template(\"simple-template.pptx\") # create template object\nslide.add_chart_from_dataframe(\n    name=\"Chart1\",\n    dataframe=df,\n) # add your dataframe\n\npresentation = Presentation()\npresentation.add_template(slide)\ntc.save_ppttc(path=\"simple-example.ppttc\")\n ```\n\nVisit the [examples folder](examples) for more examples and source files. \n\nIf you wish to learn more about this process, visit the think-cell [automation documentation](https://www.think-cell.com/en/support/manual/jsondataautomation.shtml). \n\n## Dependencies\nThinkcellBuilder has no dependencies outside the Python standard library. If you want to create charts from pandas dataframes, pandas is obviously needed.\n\n## Limitations\nIt is currently impossible to derive the types or names of Think-cell objects (e.g., charts, named textfields, etc.) in a template programatically, so all automation methods rely on typo-free expression of object names. Mis-typed chart names are silently ignored by Think-cell when it is building the presentation, so please double check your object names and types. \n\n## Contributing\n\nStart by forking this repo.\n\n\nInstall the development dependencies (you probably want to do this in a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/)):\n\n```shell\n $ pip install -r requirements-dev.txt\n ```\n\nMake sure the tests run:\n\n```shell\n $ pytest\n ```\n\nCreate a branch and submit a pull request. \n\n\n*Note: This project is in no way affiliated with think-cell Sales GmbH & Co. KG. I just wanted to make my (and hopefully your) life easier.*\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Simple unofficial Python library for generating PowerPoint presentations using Think-cell",
    "version": "0.1.0",
    "split_keywords": [
        "automation",
        "powerpoint",
        "thinkcell",
        "ppttc",
        "business",
        "consulting"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "03b36f1c98dd2e3fa9afb2cb98a71bc1",
                "sha256": "f0a21bdb875476c3b3c82b47c39a255b0afff80e66d68176669d02fcb7220fe6"
            },
            "downloads": -1,
            "filename": "ThinkcellBuilder-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "03b36f1c98dd2e3fa9afb2cb98a71bc1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11301,
            "upload_time": "2022-12-04T17:14:13",
            "upload_time_iso_8601": "2022-12-04T17:14:13.246698Z",
            "url": "https://files.pythonhosted.org/packages/6e/7c/41e38ad795d4956efb0c8a5abd78a5073cdf5cfb82fb85f956cf4245995e/ThinkcellBuilder-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "9e87c0b60bc8e8b4ae1f37d65766c1b9",
                "sha256": "0b3e96e078836c822629ddc308c5eb63198699571d0ce9a1c8a5e2bc0bd2b98b"
            },
            "downloads": -1,
            "filename": "ThinkcellBuilder-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9e87c0b60bc8e8b4ae1f37d65766c1b9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10335,
            "upload_time": "2022-12-04T17:14:16",
            "upload_time_iso_8601": "2022-12-04T17:14:16.281555Z",
            "url": "https://files.pythonhosted.org/packages/84/04/7e80c2385b4544744abac4e234d880db56576175e984db3ab0875a842f35/ThinkcellBuilder-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-04 17:14:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Philistino",
    "github_project": "ThinkcellBuilder",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "thinkcellbuilder"
}
        
Elapsed time: 0.08002s