Commands Overview
Commands are the structural directives in your template. They go in cell comments and control how XLFill processes regions of your spreadsheet — looping, branching, inserting images, merging cells, and more.
How commands work
Section titled “How commands work”Every command follows this pattern:
jx:commandName(attr1="value1" attr2="value2" lastCell="ref")- The command name follows
jx: - Attributes are
key="value"pairs - Most commands require
lastCell— the bottom-right corner of the command’s area - The cell containing the comment is the top-left corner
Multiple commands per cell
Section titled “Multiple commands per cell”Put multiple commands in the same cell comment, separated by newlines:
jx:area(lastCell="D10")jx:each(items="employees" var="e" lastCell="D1")Automatic nesting
Section titled “Automatic nesting”Commands whose areas are strictly inside another command’s area are automatically treated as children. You don’t need to declare nesting explicitly — XLFill figures it out from the geometry.
The commands
Section titled “The commands”Here’s every command available, in order of how often you’ll use them:
Core (you’ll use these on every template)
Section titled “Core (you’ll use these on every template)”| Command | What it does | Page |
|---|---|---|
| jx:area | Defines the template working region. Required on every template. | Details → |
| jx:each | Loops over a collection, repeating rows or columns for each item. The workhorse command. | Details → |
| jx:if | Conditionally shows or hides a template area. | Details → |
Data iteration and layout
Section titled “Data iteration and layout”| Command | What it does | Page |
|---|---|---|
| jx:repeat | Repeats an area N times without needing a collection. Great for blank rows, padding, and numbered rows. | Details → |
| jx:grid | Fills a dynamic grid with headers and data rows. Great for pivot-style reports. | Details → |
| jx:image | Inserts an image from byte data. Photos, logos, charts. | Details → |
| jx:mergeCells | Merges cells in a range. Useful for section headers in loops. | Details → |
| jx:updateCell | Sets a single cell’s value from an expression. For totals and summaries. | Details → |
| jx:include | Inserts content from another sheet or area. Template composition for shared headers, footers, and sections. | Details → |
Data presentation
Section titled “Data presentation”| Command | What it does | Page |
|---|---|---|
| jx:table | Creates a structured Excel table with auto-filter, banded rows, and total rows. | Details → |
| jx:chart | Embeds bar, line, pie, and other chart types with auto-sized data ranges. | Details → |
| jx:sparkline | Adds mini in-cell charts (line, column, win/loss) alongside data. | Details → |
| jx:conditionalFormat | Applies data bars, color scales, icon sets, and cell highlighting rules. | Details → |
| jx:dataValidation | Adds dropdown lists, integer/decimal constraints, and input messages. | Details → |
| jx:definedName | Creates named ranges for formulas, pivot tables, and cross-sheet references. | Details → |
Layout and formatting
Section titled “Layout and formatting”| Command | What it does | Page |
|---|---|---|
| jx:autoRowHeight | Auto-fits row height after content is written. For cells with wrapped text. | Details → |
| jx:autoColWidth | Auto-fits column widths to content. No manual resizing needed. | Details → |
| jx:freezePanes | Freezes rows and columns so headers stay visible while scrolling. | Details → |
| jx:pageBreak | Inserts page breaks for print-ready reports. One section per page. | Details → |
| jx:group | Creates collapsible outline groups for hierarchical reports. | Details → |
Protection
Section titled “Protection”| Command | What it does | Page |
|---|---|---|
| jx:protect | Protects sheets from editing — lock formulas, structure, or specific cells. | Details → |
A typical template uses 2-3 commands
Section titled “A typical template uses 2-3 commands”Don’t be overwhelmed by the list of 20 commands. Most real-world templates use just jx:area + jx:each, and occasionally jx:if. The rest are there when you need them — charts for dashboards, tables for interactive reports, data validation for input forms, protection for compliance documents.
What’s next?
Section titled “What’s next?”Start with the most important command — the one you’ll use on every template:
Or jump straight to the loop command that does most of the heavy lifting: