ThinkcellBuilder 📊
ThinkcellBuilder is a simple unofficial Python library used to build powerpoint presentations with Think-cell charts, textboxes, and tables.
This project builds on Duerto's 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 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.
$ pip install thinkcellbuilder
Tutorial and usage
Let us say you have generated a template according to think-cell's automation guidelines called simple-template.pptx with the following chart called Chart1:
The thinkcell library helps you generate a .ppttc file so that you can generate presentations based on that template using 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)
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 for more examples and source files.
If you wish to learn more about this process, visit the think-cell automation documentation.
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):
$ pip install -r requirements-dev.txt
Make sure the tests run:
$ 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.
Metadata
Release files for ThinkcellBuilder 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ThinkcellBuilder-0.1.1.tar.gz | 10.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ThinkcellBuilder-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.9 kB
Release files / ThinkcellBuilder-0.1.1.tar.gz
| Download URL | ThinkcellBuilder-0.1.1.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1e03d20f24758cb0539d46df4e399ff648b91e06751e5a1134810c7a82eed00
|
|
BLAKE2b-256 checksum How to use checksums |
7c2ddf2aa6b310964351a6d80a196d6b6c6a3926a337eaecc848d18189018b5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / ThinkcellBuilder-0.1.1-py3-none-any.whl
| Download URL | ThinkcellBuilder-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12040ff5948489e705e4b65bef617fa74c315ce0f90f8d369fd2904f719d6c1f
|
|
BLAKE2b-256 checksum How to use checksums |
8b5da31aa51d382fc9f863e81ac43b5974adca169964cf2bffef8dce8c372d51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for ThinkcellBuilder 0.1.1
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.