Overflow Tables¶
Preview Version
This documentation is currently being worked on and may be incomplete or subject to change. If you spot any mistakes or have suggestions, please contact one of the maintainers.
Dynamic tables that automatically flow content across multiple columns based on length.
When to use:¶
✅ Content length varies significantly
✅ Need multi-column horizontal flow
✅ Sections with subsections
✅ Variable amounts of content per section
(Todo: Add PDF example image)
Template Structure:¶
Special two-row table:
- Row 1: Titles ([TITLE])
- Row 2: Headers ([T_HEADER]) and Content ([T_CONTENT])
Excel / DataFrame Format:¶
| Column1 | Column2 | Column3 | ... |
|---|---|---|---|
| TITLE (Section A) | TITLE (Section B) | TITLE (Section C) | ... |
| T_HEADER | T_HEADER | T_HEADER | ... |
| T_CONTENT | T_CONTENT | T_CONTENT | ... |
| T_HEADER | T_HEADER | T_HEADER | ... |
| T_CONTENT | T_CONTENT | T_CONTENT | ... |
| ... | ... | ... | ... |
Key Points:¶
- Row 0: Section Titles
- Row 1, 3, 5, ...: Column Headers
- Row 2, 4, 6, ...: Corresponding Content
Code Example:¶
Configuration
If you are working with the PowerAutomate workflow, you want to check the Configuration Documentation for setting up the overflow table feature.
import pandas as pd
from pptx import Presentation
from effctl_lib import find_table, traverse_table
# Prepare DataFrame
df = pd.DataFrame({
'Column1': ['Section A', 'Header 1', 'Content A1', 'Header 2', 'Content A2'],
'Column2': ['Section B', 'Header 1', 'Content B1', 'Header 2', 'Content B2'],
'Column3': ['Section C', 'Header 1', 'Content C1', 'Header 2', 'Content C2'],
})
# Load and find table
presentation = Presentation("template.pptx")
tables = find_table( # This example only uses 1 table, for multiple tables loop accordingly
presentation = presentation,
slide_idx = 0, # Requires get_tables to be run first to get correct slide index
table_id = 1 # Requires get_tables to be run first to get correct table id
)
# Fill with overflow handling
traverse_table(
table_list = tables,
title_index = 0, # Title row
header_index = 1, # Even rows are content, odd rows are header
content_index = 2, # - " -
dataframe = df, # DataFrame with data
max_overflow = 650 # Max character length per column
)
presentation.save("output/overflow_table_output.pptx")
How Overflow works:¶
When content exceeds 650 characters, filling stops for the current column, column is then moved two to the right and continued there. One column is skipped for spacing.
Spacing
Disabling spacing is currently not supported.
Troubleshooting:¶
Content not appearing¶
# Verify placeholders exist
presentation = Presentation("template.pptx")
print(get_tables(presentation))
# This will return a list of all tables with their slide and table indices