Reading Excel (XLSX) Data using Agentforce Prompt Templates and Flow: A Step by Step Example Guide
A basic step by step example to demonstrate how to setup a flow for that reads XLSX files for the grounding of Prompt Templates
Reading Excel (XLSX) Data using Agentforce Prompt Templates and Flow: A Step by Step Example Guide
A basic step by step example to demonstrate how to setup a flow for that reads XLSX files for the grounding of Prompt Templates
00 :: Pre-Requisites
- Read the “**From Excel to Prompt Templates: Making Spreadsheet Data LLM-Ready with Salesforce Agentforce**” article. This is the main article that this guide related to. It is Optional but I strongly recommend that you read the background first. It goes into details that are al ignored in this guide.
- Have an XLSX file (not to big or complex to start with) uploaded as a file and have the Content Document Id for that file at the ready. The Id should start with “069”. Let’s start simple and you can explore more complex things later once you know the flow works
01 :: Install package
Install the managed of unlocked package by going to the GitHub page:
02 :: Solution
In this article we are going to build a screen flow where a user uploads an XLSX file. Using the package’s OOTB functions we convert the XLSX data to a format the LLM can read and add it to a prompt template as grounding data.
We add the default interpretation instructions to the prompt template and provide a UI input where the user can define the output instructions.
Lastly we add a screen that displays the output.
03 :: Create Prompt Template
- Go to Setup > Einstein >Einstein Generative AI > Prompt Builder
- Click “New Prompt Template” in the top right corner
- Select “Flex” as the Prompt Template Type
- Name the prompt template “XLSX Grounding Data Example”

Prompt Template Creation Screen
Next we are adding three inputs all of the **Free Text **Source Type. Name them as below and keep the API name the one that is auto generated.
- XLSX Grounding Data (LLM Text)
- LLM Text Interpretation Instructions
- Output Format Instructions

Flex Prompt Template Free Text Inputs
- Press “Next” when finished and you are directed to the prompt template details page
- In the prompt template settings go to the Model section and set the Model to “GPT5.2”, you can play around with this later if you like
- In the Prompt Text screen add the 3 input variables in the following order:
## LLM Text Interpretation Instructions
{!$Input:LLM_Text_Interpretation_Instructions}
## Grounding Data formatted at LLM Text
{!$Input:XLSX_Grounding_Data_LLM_Text}
## Output Format Instructions
{!$Input:Output_Format_Instructions}
- It should look very straight forward like below

Prompt Template Details
- Press “Save”
- Press “Activate”
- Make sure the prompt template is activated or it will not show in the next step
04 :: Create a screen flow
In this example we’re going to create a screen flow that collects all the input data required for the Prompt Template.
- Go to Setup > Process Automation > Flows
- Click the “New Flow” button on the top right
- Click on “Screen Flow” in the flow type modal
Create File Upload Screen
- Click on the + icon underneath the Start Element and add a new Screen Element

- Give the Screen an API Name and a Label like “XLSX File Upload Screen”
- From the components on the left, drag a File Upload Component to the Screen
- Give the File Upload component a Name and a Label like “XLSX File Upload”
- Optionally set Allow Multiple File to “false”
- Optionally set“.xlsx” as the only Accepted Formats
- Click Done

Create the file upload screen in the screen flow
Get Default Interpretation Instructions
- Click on the + icon underneath the XLSX File Upload Screen Element
- Search for “XLSX” or “Get Default XLSX to LLM Text Instructions” and add the “Get Default XLSX to LLM Text Instructions” element to the flow.

- Give the Element a Name and Label like “LLM_Text_Interpretation_Instructions” and “LLM Text Interpretation Instructions”

- We are not going to add any error handling for this component so we are going to move on to the next step
Convert XLSX to LLM Text
- Click on the + Underneath the “LLM Text Interpretation Instructions” element
- Search for “Convert XLSX” and add the “Convert XLSX ContentDocument to LLM Text” element to the flow.

- Give the element a Name and a Label like “XLSX Grounding Data” to keep it consistent with the prompt template variable names
- In the Input Variables section of the element go to Content Document Id and click in the input. Click the “XLSX File Upload Screen”, click the “XLSX File Upload” and click on “Content Document Ids”
- The value should now show
{!XLSX_File_Upload.contentDocIds} - Here we are linking the uploaded file and convert it

- Next note there is an option “Include Default Instructions”. If you select set this value to “true” you can ignore the previous step. This is the easiest and preferred method, but it is good to learn on how to do it. Your prompt template can also be simplified by removing the “LLM Interpretation instructions” input from the prompt template.
- Selected Sheets and DomDoc parsing we’re leaving the way they are and are out of scope for now.
Output instructions Screen
- Underneath the “XLXS Grounding Data” element click on the + icon and add a new Screen element.

- Give the screen a name and label like “Ouput Format Instructions Screen”
- From the components list drag a Long Text Area on the screen and name it “Ouput_Format_Instructions”. This is going to be used to let users define the output format.
- Press done when finished

The output format instructions sceen
Execute the Prompt Template
- Underneath the “Output Format Instructions Screen” element click on the + and add a prompt Template
- Search for “XLSX Grounding” and add the “XLSX Grounding Data Example” Prompt Template element to the flow.
- Note: If you do not see the Prompt Template you might have forgotten to activate it. Go back to the prompt tempalte and activate it, save the flow, and refresh the screen. It should be visible afterwards

- Give the template a Name and Label like “XLSX Grounding Data Prompt Template”
Next in the input variables section we can link the data the flow has gathered in the previous steps. If you followed the naming conventions this should be very easy to find:
- LLM Text Interpretation Instructions {!LLM_Text_Interpretation_Instructions.llmInstructions}
- Output format Instructions {!Ouput_Format_Instructions}
- Grounding Data (LLM Text) {!XLSX_Grounding_Data.llmText}
- Click “Done” when finished, we can leave the rest as is

The Prompt Template Input Variables
Display the results
- Click on the + icon underneath the “XLSX Grounding Data Prompt Template” element and add a new Screen element
- Name the element “Prompt Template Output Screen”

- From the left drag a “Display Text” component to the screen and name it “Prompt_Template_Output_Display_Text”
- In the properties of the display text click “Add resource”, Click “Outputs From XLSX Grounding Data Prompt Template” and then the “promptResponse” variable. It looks like this when complete: {!XLSX_Grounding_Data_Prompt_Template.promptResponse}
- Click “Done” when finished

Prompt Template Output Screen
Save the flow
- Click “Save” in the top right
- Give the flow a name and label like “XLSX Grounding Data Example”. I like to keep the flow and prompt template name the same if they have a single purpose.
05 :: Testing Time
You now have the flow finished, so it is time to press the “Debug” or “Run” button.
Start by uploading a file. In my example I upload a file that lists out the total number of gifts you get on in the 12 days of Christmas. It als does the some for 30 days and 60 days of Christmas.

Text Excel Sheet for upload

Run Flow: File upload
Next provide the output instructions for your Excel input. I want the LLM to tell me that the sheet is all about the “N Days” of Christmas and calculates the cummulative totals and out the response as a JSON, because it has to be a usefulish example :-)

Run Flow: Provide the Output instructions
Let’s wait and behold what the LLM has cooked up… To me the results do not disappoint at all. I get an array of goals by simply uploading a sheet.

Run Flow: Example Prompt Data Output
Pro-Tip: If you want to see the reasoning applied by the LLM you can use the following output instructions:
## OUTPUT INSTRUCTIONS
- First, explain the detected structure of each sheet
- Then extract the meaningful data based on that structure
- The exact output format will be defined separately.
- Follow any additional instructions provided for formatting or mapping the extracted data.
- Focus on correctness, structure, and completeness over formatting.
Conclusion and Next Steps
As you have seen, this example is very simple but it shows the power of how you can declaratively add Excel data as inputs to a Prompt Template Using nothing but Flow. This only takes a few minutes to setup and you have created yourself an incredible amount of possible use cases
As the next steps I would suggest you play around with the flows, add error handling and test how big your inputs can go. There are absolutely limits that apply here and it’s not for massive sheets, but nonetheless it can do a serious amount.
Final Note
At the time of writing I am a Salesforce employee. The above article describes my personal views and techniques only. The content is in no way, shape or form official advice of any kind. It’s purely meant to be informative.
Anything from the article is not per definition the view of Salesforce as an Organization. Always speak to a certified implementation partner before implementing anything your read on the internet, especially when it’s security related and/or consumption based.
Resources
- From Excel to Prompt Templates: Making Spreadsheet Data LLM-Ready with Salesforce Agentforce
- Reading Excel Files Using the Apex Zip Functionality
- Creating Excel (XLSX) Files Using The New Apex Zip Functionality
- Convert Prompt Templates To Related Salesforce Records Fully Declaratively
- Convert Prompt Templates To Related Salesforce Records Fully Declaratively — Example Step By Step Instructions

Cover Image generated by ChatGPT
메타데이터
- post_id
- 5e4bc79c0d97
- slug
- reading-excel-xlsx-data-using-agentforce-prompt-templates-and-flow-a-step-by-step-example-guide-5e4bc79c0d97
- url
- https://medium.com/@justusvandenberg/reading-excel-xlsx-data-using-agentforce-prompt-templates-and-flow-a-step-by-step-example-guide-5e4bc79c0d97
- canonical_url
- https://medium.com/@justusvandenberg/reading-excel-xlsx-data-using-agentforce-prompt-templates-and-flow-a-step-by-step-example-guide-5e4bc79c0d97
- author_url
- https://medium.com/@justusvandenberg
- status
- ok
- fetched_at
- 2026-06-23 17:05:31