How-To: Embed File into a Template Input
Overview
In this tutorial, you'll walk through the steps to embed the contents of a text file into the message of an email, slack, or ChatGPT template.
Templates that support file embedding in template input include:
Email: supports .txt, .csv, and .md files in the
Message
fieldSlack: supports .txt, .csv, and .md files in the
Message
fieldChatGPT Generate Message: supports .txt, .csv, and .md files in
prompt
Interested in more?
Submit a ticket https://agencypmg.atlassian.net/servicedesk/customer/portals to request adding this ability to more templates
Setup
This tutorial assumes that you have a text file, CSV file, or Markdown file ready to embed into an chatGPT prompt. There are a few ways to provide your file in Workflows:
Download the file dynamically, like from a Google Sheet, Airtable, or a database like Alli Data, Bigquery, or a cloud storage provider, like Amazon S3 or Google Drive.
Generate the file programmatically using another task or script upstream in your Workflow.
If you are embedding directly through the Prompt field, ensure the file contents are properly formatted (e.g., use CSV headers, Markdown syntax) to ensure accurate processing.
Note: When you insert a file's contents directly into your Slack message, email, or even a ChatGPT prompt, the file is converted into a single string. This can significantly increase the total message length. If the file is large, this might hit size limits or make the message hard to read. In those cases, it’s better to attach the file instead of embedding it directly.
Embedding Files into a ChatGPT Prompt in Workflows
Add a Task to your Workflow using the ChatGPT - Generate Response Template.
In the Prompt field, write your instructions. Where you want to insert file content, use
{{text:filename}}
.
Examples:{{text:output.txt}}
{{text:weekly_performance.csv}}
{{text:markdowndata.md}}
Replace
filename
with the name of the file generated by a previous Task in your Workflow.Supported file types for embedding:
.txt
(text files).csv
(CSV files).md
(Markdown files)
Connect the Tasks:
Your first Task should create or download the file.
Connect it directly to your ChatGPT Task.
Save the Workflow once the Tasks are connected.
Tips for Using Multiple Embedded Files
You can embed multiple files into one prompt, but keep it manageable to avoid overload in the input fields, which may have limits depending on the service.
Example setup:
Pull a weekly report example from Google Drive (
example_report.txt
).Pull a weekly performance CSV from Alli Data (
weekly_performance.csv
).
Example prompt:
Using {{text:example_report.txt}} as your reference for style and tone, create a summary of the past week's performance based on the data in {{text:weekly_performance.csv}}.