The AI insight function#
RW.Tools.AIInsight calls a configured AI provider with a prompt and writes the response directly into a named Excel TextBox or a target cell at report-generation time. Use it to embed AI-generated summaries, commentary or analysis into a report without any manual copy-and-paste step.
Alias: RWAIINSIGHT.
This is the only generative worksheet function. The AI*-aliased functions (AIEXTRACT, AIINPUT and the rest) are the Workday Adaptive connector, where "AI" stands for Adaptive Insights. They have nothing to do with large language models.
Prerequisites#
An AI provider must be configured and enabled before this function does anything. See Connect an AI provider.
RW.Tools.AIInsight#
Signature
=RW.Tools.AIInsight(providerName, destination, prompt, [dataRange], [maxTokens])
| # | Argument | Type | Default | Meaning |
|---|---|---|---|---|
| 1 | providerName |
String | required | The Name or ProviderId of a configured AI provider, for example "OpenAI". Lookup is case-insensitive. |
| 2 | destination |
String or cell reference | required | Where the response is written. A string is treated as a TextBox name; a cell reference writes to a cell. |
| 3 | prompt |
String | required | The prompt sent to the provider. |
| 4 | dataRange |
Range | none | A range whose values are appended to the prompt as a Markdown table. |
| 5 | maxTokens |
Integer | 1000 |
The maximum output tokens the provider may return, itself capped by the provider's own configured limit. |
The first three arguments are required.
How the prompt is built#
The full prompt sent to the provider is assembled in two parts:
- The literal text you supplied in
prompt. - If
dataRangeis supplied, a blank line followed by that range rendered as a Markdown table.
That is the whole mechanism. There is no hidden system prompt added by the function itself, and no chunking: the range goes over as a table.
Where the response goes#
A TextBox destination searches every worksheet in the workbook for a TextBox with that name, and replaces its text content with the response. If no TextBox with that name exists anywhere, a warning is logged and the workbook is left unchanged.
A cell destination writes to the top-left cell of the reference you supply. If you pass a range, only its top-left cell is used.
On success the formula cell itself is set to an empty string. The response goes only to the destination, never to the formula cell. On failure the formula cell is set to #VALUE!.
Execution order#
RW.Tools.AIInsight runs after all data-import formulas, after RW.Tools.Sort, and after row suppression. That ordering is deliberate: when you pass a dataRange, the model sees the fully expanded, sorted and suppressed dataset rather than the template's placeholder rows.
Examples#
An AI summary into a TextBox, with data
=RW.Tools.AIInsight("OpenAI", "TextBox1", "Provide a one-paragraph executive summary of this data.", A1:C20, 500)
Calls the OpenAI provider, appends the values in A1:C20 as a Markdown table, and writes the response into the TextBox named TextBox1.
A response into a cell
=RW.Tools.AIInsight("OpenAI", D5, "Summarize the key trends in this range.", A1:C5)
A plain prompt with no data range
=RW.Tools.AIInsight("Azure OpenAI", "CommentaryBox", "What are the top three risks in a declining revenue scenario?")
A larger token budget
=RW.Tools.AIInsight("OpenAI", "SummaryBox", "Summarize this quarter's performance.", B2:F30, 2500)
When an argument is wrong#
Several of these fail quietly, which is worth knowing before you debug a blank TextBox.
| Situation | Result |
|---|---|
providerName, destination or prompt is empty or missing |
Formula error. |
| The named provider is not found | Error written to the formula cell; the AI call is skipped. |
| The provider is found but disabled | Error written to the formula cell; the AI call is skipped. |
No TextBox with the destination name exists |
Warning logged, workbook unchanged. The formula does not error. |
The dataRange worksheet is not found |
dataRange is silently ignored and the prompt is sent without any table data. |
| The provider returns an error | Error written to the formula cell. |
Use cases#
- Executive summary on a management pack. A TextBox on the cover sheet is filled with a one-paragraph summary of the numbers on the sheets behind it.
- Narrative for a deck. A TextBox destination pairs well with PowerPoint output, so AI-generated narrative flows into the slide that links to that shape.
- Per-entity commentary in a burst. Because the function runs per report, a bursted pack gets commentary written against each recipient's own filtered data rather than the consolidated total.
Notes and limits#
- The function is inert in desktop Excel. It only runs inside a Reportworq job.
- Adding it to a workbook has no effect on other formulas or data in that workbook.
- Every call is a real provider call with real latency and cost. A bursted job calls the provider once per report.
- Governance, provider choice, prompt storage and auditing are covered in the AI and Integrations guide.
- Available since around v5.0.0.91. Version availability is approximate.
Related pages#
- Functions overview: which one do I use
- Connect an AI provider for the prerequisite setup.
- AI-generated insights in reports for the wider feature this function belongs to.
- Workday Adaptive functions, which are the
AI*functions that are not AI.
Feedback on this page
Comments, questions, requests, or something missing or unclear? Email us - the page you are on is filled in for you.
Email feedback on this pageOr write to support@reportworq.com directly.