Download Reportworq

This is the archived documentation for Reportworq 5. It is kept for reference and is no longer updated.

Go to the Reportworq 6 documentation

Overview#

Reportworq is designed to support all of Microsoft Excel's standard, built-in functions. Reportworq additionally supports several data provider-specific Excel functions which are documented, per data provider, in Datasources documentation.

Reportworq does not support the use of Visual Basic for Applications or any other scripting languages, but it does include several Reportworq-specific Microsoft Excel functions that are designed to perform common reporting and data integration tasks that enhance its report distribution and data collection capabilities:

Data Collection#

Reportworq supports several functions that are used to "writeback" data into configured data sources like SQL, Anaplan, IBM Planning Analytics and Workday (specifically Standard Sheets, Modeled Sheets, and Adaptive Cube Sheets). These formulas are only available and executed when Reportworq receives a file for processing using a Reportworq Data Collection license.

Tap or click the image to view it full screen

Ranges and Tables#

Several Reportworq-specific functions support a "Range or Table Name" parameter that is typically used when specifying a location for data to be output to. These parameters are used to target either a specific range or even Microsoft Excel tables with some of the following options:

Reference TargetDescriptionExamples
Excel Table by NameReportworq will search for an Excel table with this name and repopulate the table with data for any table heading names that match data source column names. The table must have "Show Header Row" enabled. Please see a note below about referencing tables when bursting to multiple worksheets"Table 3"
Excel Table by ReferenceWhen using a parameter to create multiple copies of a worksheet containing the Excel table you want to reference, it is not possible to reference the table name as a string because copies of it will get a new ID on each worksheet. Instead, you must:
- Reference a cell in the data range of the table (not a column heading).
- Use the INDIRECT formula in any custom-calculated columns to make relative references to other values in the table's data. This is needed because when the worksheet is copied any formula references to the table will otherwise point to the wrong table. For example, to reference the cell in the previous column: =INDIRECT(ADDRESS(ROW(), COLUMN() - 1))
A2
A2 in this example is the first data value in a table that spans A1:G15 and has the required header row enabled.
Single Row / CellReportworq will populate data starting with the top left cell address, overwriting anything below and to the right of that cell.B10
B:B
Multi-Row RangeReportworq will clear and delete the range before inserting rows required to populate data, and will not overwrite anything below and to the right of that range.A1:M30
B:Z

RW.TOOLS.PAGEBREAK#

General Purpose#

RW.Tools.PageBreak also known as RWPageBreak inserts a horizontal or vertical page break relative to the row or column that contains the formula. If you are on a version earlier than 5.0.0.91 please use RWPageBreak.


Syntax#

=RW.Tools.PageBreak(doBreak, [mode], [position])

Arguments#

#NameTypeDefaultDescription
1doBreakBoolean(required for a visible effect)When TRUE, a page break is inserted.
2modeString / Boolean"horizontal""horizontal"/TRUE or "vertical"/FALSE.
3positionString / Boolean"before""before"/TRUE or "after"/FALSE.

Behavior#


Usage notes#


Examples#

=RW.Tools.PageBreak(TRUE)
=RW.Tools.PageBreak(TRUE, "horizontal", "after")
=RW.Tools.PageBreak(A1, "vertical", "before")

Common mistakes#


RW.TOOLS.REMOVEFORMULA#

The RW.TOOLS.REMOVEFORMULA aka RWRemoveFormula function removes formulas from a specified range of cells at report generation time, replacing them with their static values. If you are on a version earlier than 5.0.0.91 please use RWRemoveFormula.

At the job distribution level when exporting to Excel you can define if you want to keep all formulas, remove all formulas, remove provider formulas, remove provider formulas (except writeback) but if you need more control/finesse over what formula cells are left and which remain you can use that is when you would want to use RW.TOOLS.REMOVEFORMULA.

Syntax#

=RW.Tools.RemoveFormula(doRemove, targetRange, [mode])

Arguments#

#NameTypeDefaultDescription
1doRemoveBoolean(required)When TRUE, formulas are converted to values.
2targetRangeCell / range / row / column / multi-range(required)Area to process.
3modeString / Boolean"all""all"/TRUE removes every formula; "provider"/FALSE removes only TM1 provider formulas.

Behavior#


Usage notes#


Examples#

=RW.Tools.RemoveFormula(TRUE, A1)
=RW.Tools.RemoveFormula(TRUE, A:A)
=RW.Tools.RemoveFormula(TRUE, {A1:A2,B3:B4}, "provider")

Common mistakes#

SituationResult
Omitting targetRangeFormula errors because at least two parameters are required
Expecting blank/non-formula cells to changeNon-formula cells are ignored
Using provider mode on non-provider formulasThose formulas are left in place

RW.TOOLS.RESIZE#

The RW.TOOLS.RESIZE function aka RWResize automatically resizes the row height or column width of the cell it is placed in at report generation time. It works like Excel's "AutoFit" feature, but applied dynamically as part of the Reportworq report run to ensure rows and columns fit their content after all data has been populated. If you are on a version earlier than 5.0.0.91 please use RWResize.

Syntax#

=RW.Tools.Resize([type], [pad])

Arguments#

#NameTypeDefaultDescription
1typeString / Boolean"rows""rows"/TRUE resizes the row; "columns"/FALSE resizes the column.
2padNumber0Extra size to add after auto-fit. Positive values only have an effect.

Behavior#


Usage notes#


Examples#

=RW.Tools.Resize()
=RW.Tools.Resize("columns")
=RW.Tools.Resize("rows", 5)

Common mistakes#

Supplying a text value for pad; the implementation only applies padding when the second argument is numeric.

Expecting hidden rows or columns to resize.

RW.TOOLS.SORT#

The RW.TOOLS.SORT aka RWSort function will sort a range or Excel Table (ListObject) at report generation time, directly within the Reportworq template. It supports sorting by up to three columns in any combination of ascending or descending order, and can optionally limit the output to the top N or bottom N rows after sorting. If you are on a version earlier than 5.0.0.91 please use RWSort.

Syntax#

=RW.Tools.Sort(sortRange, [key1], [ascending1], [key2], [ascending2], [key3], [ascending3], [limitType], [limitCount])

All arguments after sortRange are optional.


Arguments#

#NameTypeDefaultDescription
1sortRangeString / Range(required)The cell address (e.g. "A1:D30") or named table to sort. Can reference a range on the same sheet.
2key1Integer0Column index (1-based, relative to the sort range) to use as the primary sort key. 0 means no sort.
3ascending1BooleanTRUETRUE sorts key1 ascending; FALSE sorts descending.
4key2Integer0Column index for the secondary sort key. Applied only when key1 values are equal.
5ascending2BooleanTRUESort direction for key2.
6key3Integer0Column index for the tertiary sort key. Applied only when both key1 and key2 values are equal.
7ascending3BooleanTRUESort direction for key3.
8limitTypeString(none)"TOP" retains the first N rows after sorting; "BOTTOM" retains the last N rows. Case-insensitive. Omit to keep all rows.
9limitCountInteger(none)Number of rows to keep when limitType is specified. Must be a positive whole number.

Note: limitType and limitCount must be supplied together as the last two arguments. They are detected automatically — no placeholder arguments are needed.


Examples#

Sort by the first column ascending (implicit)

=RW.Tools.Sort("A1:D30")

Sort by the first column ascending (explicit)

=RW.Tools.Sort("A1:D30", 1, TRUE)

Sort by the first column ascending, then second column descending

=RW.Tools.Sort("A1:D30", 1, TRUE, 2, FALSE)

Sort by three columns

=RW.Tools.Sort("A1:D30", 1, TRUE, 2, TRUE, 3, FALSE)

Sort by the first column and keep the top 5 rows

=RW.Tools.Sort("A1:D30", 1, TRUE, "TOP", 5)

Sorts column 1 ascending, then hides every row beyond position 5.

Sort by the first column descending and keep the bottom 3 rows

=RW.Tools.Sort("A1:D30", 1, FALSE, "BOTTOM", 3)

Because the data is sorted descending, the last 3 rows represent the three smallest values.

Sort by two columns and return the top 10 rows

=RW.Tools.Sort("A1:D30", 1, TRUE, 2, TRUE, "TOP", 10)

Keep the top 5 rows without specifying a sort key

=RW.Tools.Sort("A1:D30", "TOP", 5)

Uses whatever order the data is already in and hides all rows after the 5th.


Behavior#

Sort range

The sortRange argument may be:

Column key indexes are 1-based and relative to the sort range. If the range starts at column D, key 1 refers to column D, key 2 to column E, and so on.

Execution order

RW.Tools.Sort runs as a one-time post-processing step after all data-import formulas (e.g., RW.Relational.Export) have populated the workbook, and before any row-suppression (RW.TOOLS.SUPPRESS) pass.

This means:

TOP / BOTTOM limit

When limitType and limitCount are supplied:

  1. The sort is performed first (if sort keys are specified).
  2. Rows outside the requested limit are hidden (not deleted).
limitTypeRows kept visibleRows hidden
"TOP"First limitCount rows of the sorted rangeAll rows after position limitCount
"BOTTOM"Last limitCount rows of the sorted rangeAll rows before the last limitCount rows

If limitCount is greater than or equal to the total number of rows in the range, no rows are hidden.

Hidden rows

Rows hidden by the TOP/BOTTOM limit behave like any other hidden row in Excel. They are included in the workbook but not printed or displayed. They can be revealed by RW.TOOLS.SUPPRESS or standard Excel unhide operations.


Argument validation and error handling#

SituationBehavior
sortRange is missingFormula error — sortRange is required
More than 9 arguments providedFormula error — too many parameters
key1/key2/key3 is 0That sort level is skipped
limitType is "TOP" or "BOTTOM" but limitCount is zero, negative, or not a whole numberThe TOP/BOTTOM pattern is not recognized; the arguments are treated as regular sort parameters, which will produce a parse error
limitCount ≥ total rows in rangeNo rows hidden; all rows remain visible

RW.TOOLS.SUPPRESS#

The RW.TOOLS.SUPPRESS aka RWSuppress function is used to enable custom suppression of rows and/or columns. Suppression can hide or delete the row/columns based on the condition in the Enable parameter. While this function is typically used to check for zero or blank values (zero suppression), any expression can be used. If you are on a version earlier than 5.0.0.91 please use RWSuppress.

Syntax#

=RW.Tools.Suppress(doSuppress, [type], [mode])

Arguments#

#NameTypeDefaultDescription
1doSuppressBooleanFALSEWhen TRUE, suppression is applied.
2typeString / Boolean"rows""rows"/TRUE or "columns"/FALSE.
3modeString / Boolean"delete""delete"/TRUE removes the rows or columns; "hide"/FALSE hides them.

Behavior#


Usage notes#


Examples#

=RW.Tools.Suppress(A1=0)
=RW.Tools.Suppress(TRUE, "rows", "delete")
=RW.Tools.Suppress(TRUE, "columns", "hide")

Common mistakes#

SituationResult
Assuming the default mode is hideThe default mode is delete
Placing suppression formulas expecting top-down delete orderReportWorq processes rows bottom-up and columns right-to-left
Forgetting that hidden rows/columns still existUse delete if they must be removed completely

RW.Tools.SheetColor#

This function is only available in version 5.0.0.91 or later. Sets the worksheet tab color from inside Excel when the Sheet Tab Color worksheet option is not configured in the Reportworq UI.


Syntax#

=RW.Tools.SheetColor(value)

value should evaluate to a color value supported by the existing worksheet tab color behavior, such as:


Examples#

=RW.Tools.SheetColor("#4F81BD")
=RW.Tools.SheetColor(A1)
=RW.Tools.SheetColor("Red")

Behavior#


Error behavior#

When the UI option is configured, each RW.Tools.SheetColor formula on that worksheet is marked as an error:

RW.Tools.SheetColor was ignored because Sheet Tab Color is configured in the Reportworq worksheet options.

When multiple RW.Tools.SheetColor formulas exist on the same worksheet, all of them are marked as errors:

Multiple RW.Tools.SheetColor formulas were found on this worksheet. Only one is allowed, so no formula-based sheet tab color was applied.

If the formula returns a value that cannot be applied as a worksheet tab color, no formula-based color is applied and the formula is marked as an error.

Example error:

Error setting tab color on sheet 'Sheet1' using value 'NotAColor'.

RW.Tools.SheetName#

This function is only available in version 5.0.0.91 or later. Sets a worksheet's output name from inside Excel when the Sheet Name worksheet option is not configured in the Reportworq UI.


Syntax#

=RW.Tools.SheetName(value)

value should evaluate to the worksheet name you want to use.


Examples#

=RW.Tools.SheetName("P&L")
=RW.Tools.SheetName(A1)
=RW.Tools.SheetName("Sales - " & B1)

Behavior#


Error behavior#

When the UI option is configured, each RW.Tools.SheetName formula on that worksheet is marked as an error:

RW.Tools.SheetName was ignored because Sheet Name is configured in the Reportworq worksheet options.

When multiple RW.Tools.SheetName formulas exist on the same worksheet, all of them are marked as errors:

Multiple RW.Tools.SheetName formulas were found on this worksheet. Only one is allowed, so no formula-based sheet name was applied.

If the formula does not return a valid worksheet name, no formula-based rename is applied and the formula is marked as an error.
To be valid, the formula result must:

In practice, that means the final name still needs to fit Excel's worksheet naming restrictions such as length limits and disallowed characters.

Example error:

RW.Tools.SheetName did not return a valid worksheet name.

RW.Tools.SheetSuppress#

This function is only available in version 5.0.0.91 or later. Suppresses a worksheet from inside Excel when the Sheet Suppression worksheet option is not configured in the Reportworq UI.


Syntax#

=RW.Tools.SheetSuppress(value)

value should evaluate to a suppression flag. Values that behave like the existing worksheet suppression logic will suppress the sheet, including:

Any other value leaves the sheet in place.


Examples#

=RW.Tools.SheetSuppress(TRUE)
=RW.Tools.SheetSuppress(A1)
=RW.Tools.SheetSuppress(COUNTIF(A1:A10, "Error") > 0)

Behavior#


Error behavior#

When the UI option is configured, each RW.Tools.SheetSuppress formula on that worksheet is marked as an error:

RW.Tools.SheetSuppress was ignored because Sheet Suppression is configured in the Reportworq worksheet options.

When multiple RW.Tools.SheetSuppress formulas exist on the same worksheet, all of them are marked as errors:

Multiple RW.Tools.SheetSuppress formulas were found on this worksheet. Only one is allowed, so no formula-based sheet suppression was applied.

Formula-based suppression is evaluated independently from sheet naming and sheet tab color, so an invalid RW.Tools.SheetSuppress formula does not block those other worksheet features.

RW.Tools.Group#

This function is only available in version 5.0.0.91 or later. Creates Excel outline groups at report-generation time for repeated rows or columns.


Syntax#

=RW.Tools.Group(identifier, [axis], [visible], [additionalGroupDepth])

Arguments#

#NameTypeDefaultDescription
1identifierString / number / Boolean(required)Group key for the current row or column. Blank means "do not group this position."
2axisString"rows""rows" or "columns".
3visibleString"show""show" starts the group expanded; "hide" starts it collapsed.
4additionalGroupDepthInteger0Adds extra grouping depth for the same body range.

Behavior#


Usage notes#


Examples#

=RW.Tools.Group("East")
=RW.Tools.Group("Product A", "rows", "hide")
=RW.Tools.Group("Quarter", "columns", "show", 1)

Common mistakes#

SituationResult
Blank identifiers mixed into the middle of a blockThe current group ends at the blank
Expecting the first matching row/column to collapse with the groupThe first match is the summary/header and stays outside the grouped body
Invalid axis or visible valuesReportworq logs a warning and falls back to the default

RW.Tools.BlankRow#

This function is only available in version 5.0.0.91 or later. Inserts one or more blank rows adjacent to the row containing the formula at report-generation time.

Rows are inserted after all runtime expansion steps (e.g., RW.Relational.Export) and before row suppression (RW.TOOLS.SUPPRESS), giving you deterministic spacing that works with dynamic reports.


Syntax#

=RW.Tools.BlankRow([doInsert], [count], [mode], [insertAbove], [rowHeight])

All arguments are optional.


Arguments#

#NameTypeDefaultDescription
1doInsertBooleanTRUEWhen TRUE the formula inserts rows. When FALSE the formula is a no-op (useful for conditional insertion via a cell reference).
2countInteger1Number of blank rows to insert. Must be a whole number between 0 and 1000. A value of 0 or a negative number inserts nothing (a warning is logged for negative values).
3modeString"blank"Controls how inserted rows are formatted. Accepted values: "blank" — rows have no formatting; "copyformat" — rows inherit the style of the row immediately above the insertion point.
4insertAboveBooleanTRUEWhen TRUE rows are inserted above the anchor row (the row containing the formula), shifting the anchor row downward. When FALSE rows are inserted below the anchor row.
5rowHeightNumber(none)Explicit height in points for each inserted row. When omitted the row height is determined by the mode and the workbook's default. Must be a non-negative number.

Examples#

Insert one blank row above the current row (default behavior)

=RW.Tools.BlankRow()

Insert one blank row above (explicit)

=RW.Tools.BlankRow(TRUE)

Insert three blank rows above

=RW.Tools.BlankRow(TRUE, 3)

Insert two blank rows below the current row

=RW.Tools.BlankRow(TRUE, 2, "blank", FALSE)

Insert two rows above with copyformat

=RW.Tools.BlankRow(TRUE, 2, "copyformat")

Insert one blank row above with an explicit row height of 18 points

=RW.Tools.BlankRow(TRUE, 1, "blank", TRUE, 18)

Conditional insertion controlled by another cell

=RW.Tools.BlankRow(A1, 2)

Inserts two rows when the value of cell A1 is TRUE; does nothing when FALSE.


Behavior#

Anchor row

The anchor row is the row that contains the RW.Tools.BlankRow formula. Inserted rows appear immediately above or below it depending on insertAbove.

Execution order

RW.Tools.BlankRow runs after all data-import and row-expansion steps (e.g., RW.Relational.Export) and immediately before RW.TOOLS.SUPPRESS. This means:

Multiple RW.Tools.BlankRow on the same row

If more than one RW.Tools.BlankRow formula exists on the same row, the engine consolidates them into a single instruction using the following rules:

Multiple anchors on the same sheet

Insertions are processed top-to-bottom. Each insertion shifts all subsequent anchor rows downward, so the reported row numbers automatically stay correct.


Argument validation and error handling#

Invalid arguments never crash report generation. Instead, a warning is logged and a safe default is used:

SituationBehavior
count is not a whole number (e.g., 1.5)Warning logged; count treated as 0, insertion skipped
count is negativeWarning logged; count treated as 0, insertion skipped
count exceeds 1,000Warning logged; capped to 1000
mode is not "blank" or "copyformat"Warning logged; defaults to "blank"
rowHeight is negativeWarning logged; row height not set
rowHeight is non-numericWarning logged; row height not set

RW.Tools.AIInsight#

This function is only available in version 5.0.0.91 or later. 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 RW.Tools.AIInsight to embed AI-generated summaries, commentary, or analysis into your Excel reports without any manual copy-and-paste step.


Syntax#

=RW.Tools.AIInsight(providerName, destination, prompt, [dataRange], [maxTokens])

The first three arguments are required.


Arguments#

#NameTypeDefaultDescription
1providerNameString(required)The Name or ProviderId of a configured AI provider (e.g. "OpenAI"). Lookup is case-insensitive. Configure providers under Administration > AI Providers.
2destinationString / Cell Reference(required)Where the AI response is written. Supply a TextBox name (string) to write to a named shape, or a cell reference to write to a cell. When a cell reference is supplied, only the top-left cell of the reference is used.
3promptString(required)The prompt sent to the AI provider.
4dataRangeRange(none)An optional cell range whose values are appended to the prompt as a Markdown table. Useful for asking the AI to summarize or analyse specific report data.
5maxTokensInteger1000Maximum number of output tokens the AI provider may return. Capped by the provider's own configured limit.

Examples#

Write an AI summary to a TextBox

=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 to the prompt, and writes the response into the TextBox named TextBox1.

Write an AI response to a cell

=RW.Tools.AIInsight("OpenAI", D5, "Summarize the key trends in this range.", A1:C5)

Writes the AI response into cell D5 (top-left of the supplied reference).

Plain prompt without data range

=RW.Tools.AIInsight("Azure OpenAI", "CommentaryBox", "What are the top three risks in a declining revenue scenario?")

Sends a standalone prompt to the Azure OpenAI provider and places the response in the CommentaryBox TextBox.

Custom token limit

=RW.Tools.AIInsight("OpenAI", "SummaryBox", "Summarize this quarter's performance.", B2:F30, 2500)

Behavior#

Provider resolution

The provider is looked up by matching the providerName argument against the Name and ProviderId of every enabled AI provider configured in ReportWorq (case-insensitive). If no match is found, or the matched provider is disabled, the formula logs an error.

Prompt construction

The full prompt sent to the AI provider is built as follows:

  1. The literal text supplied in the prompt argument.
  2. If dataRange is supplied, a blank line followed by the range data rendered as a Markdown table is appended.

Destination: TextBox

When destination is a string, the formula searches all worksheets in the workbook for a TextBox with that name and replaces its text content with the AI response. If no TextBox with that name exists, a warning is logged and no change is made.

Destination: Cell

When destination is a cell reference, the AI response is written to the top-left cell of the referenced area.

Execution order

RW.Tools.AIInsight runs after all data-import formulas (e.g., RW.Relational.Export), sorting (RW.TOOLS.SORT), and row suppression. This ensures the AI receives the fully expanded, sorted dataset when a dataRange is specified.

Formula cell value

On success, the cell containing the RW.Tools.AIInsight formula is set to an empty string. The AI response is written exclusively to the destination, not to the formula cell itself. On failure (provider not found, provider disabled, or AI call error), the formula cell is set to a #VALUE! error value.


Argument validation and error handling#

SituationBehavior
providerName is empty or missingFormula error
destination is empty or missingFormula error
prompt is empty or missingFormula error
Provider not foundError written to formula cell; AI call skipped
Provider is disabledError written to formula cell; AI call skipped
TextBox named destination not foundWarning logged; workbook unchanged
dataRange worksheet not founddataRange silently ignored; prompt sent without table data
AI provider returns an errorError written to formula cell

Prerequisites#

An AI provider must be configured and enabled in ReportWorq before using RW.Tools.AIInsight. Navigate to Administration > AI Providers to add and enable a provider.


Usage notes#


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 page

Or write to support@reportworq.com directly.