Dynamic Content with Replacements¶
Replacements dynamically insert content into rendered Slides decks and marker-scoped Docs sections. This content can be simple text, entire tables, or text generated by an AI model.
Core Concepts¶
All replacements are defined within the replacements list of a presentation.slides[] item in your config.yml. For Google Slides, the item targets a slide ID. For Google Docs, the same id targets a section marker such as {{SECTION:intro}}. Each replacement has a type and a config block.
Types of Replacements¶
SlideFlow supports three types of replacements:
1. Text Replacement (text)¶
This is the simplest type of replacement. It replaces a placeholder in the targeted slide or document section with a static or dynamic text value.
Static Example:
Dynamic Example:
This example fetches a single value from a data source and uses a custom function to format it.
- type: "text"
config:
placeholder: "{{TOTAL_REVENUE}}"
data_source:
type: "csv"
name: "sales_data"
file_path: "data/sales.csv"
value_fn: "get_first_value"
value_fn_args:
column: "revenue"
2. Table Replacement (table)¶
This replacement type allows you to populate table-like placeholders from a DataFrame. It works by mapping each cell in the DataFrame to a placeholder in the targeted slide or document section.
The placeholders are in the format {{PREFIXrow,col}}, where PREFIX is a prefix you define, row is the 1-based row index, and col is the 1-based column index.
Example:
- type: "table"
config:
prefix: "SALES_DATA_"
data_source:
type: "csv"
name: "sales_data"
file_path: "data/sales.csv"
This maps the value in the first row and first column of your CSV to the placeholder {{SALES_DATA_1,1}}, the value in the first row and second column to {{SALES_DATA_1,2}}, and so on.
3. AI Text Replacement (ai_text)¶
This replacement type uses an AI provider (like OpenAI, Databricks, or Gemini) to generate text based on a prompt. You can also provide a data source to enrich the prompt with your data.
Example:
- type: "ai_text"
config:
placeholder: "{{SUMMARY}}"
prompt: "Write a short summary of the following sales data:"
provider: "openai"
provider_args:
model: "gpt-4o"
data_source:
type: "csv"
name: "sales_data"
file_path: "data/sales.csv"
When this replacement is processed, SlideFlow appends the data from sales.csv to the prompt before sending it to the configured AI provider.
Data Sources and Transformations¶
All replacement types can have a data_source and a list of data_transforms. This allows you to fetch data from any supported source and to clean, reshape, or aggregate it before it's used in your replacement.
For detailed connector setup and transform contracts, see:
For provider-specific AI setup and credentials, see: