Skip to content

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.

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

Put multiple commands in the same cell comment, separated by newlines:

jx:area(lastCell="D10")
jx:each(items="employees" var="e" lastCell="D1")

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.

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)”
CommandWhat it doesPage
jx:areaDefines the template working region. Required on every template.Details →
jx:eachLoops over a collection, repeating rows or columns for each item. The workhorse command.Details →
jx:ifConditionally shows or hides a template area.Details →
CommandWhat it doesPage
jx:repeatRepeats an area N times without needing a collection. Great for blank rows, padding, and numbered rows.Details →
jx:gridFills a dynamic grid with headers and data rows. Great for pivot-style reports.Details →
jx:imageInserts an image from byte data. Photos, logos, charts.Details →
jx:mergeCellsMerges cells in a range. Useful for section headers in loops.Details →
jx:updateCellSets a single cell’s value from an expression. For totals and summaries.Details →
jx:includeInserts content from another sheet or area. Template composition for shared headers, footers, and sections.Details →
CommandWhat it doesPage
jx:tableCreates a structured Excel table with auto-filter, banded rows, and total rows.Details →
jx:chartEmbeds bar, line, pie, and other chart types with auto-sized data ranges.Details →
jx:sparklineAdds mini in-cell charts (line, column, win/loss) alongside data.Details →
jx:conditionalFormatApplies data bars, color scales, icon sets, and cell highlighting rules.Details →
jx:dataValidationAdds dropdown lists, integer/decimal constraints, and input messages.Details →
jx:definedNameCreates named ranges for formulas, pivot tables, and cross-sheet references.Details →
CommandWhat it doesPage
jx:autoRowHeightAuto-fits row height after content is written. For cells with wrapped text.Details →
jx:autoColWidthAuto-fits column widths to content. No manual resizing needed.Details →
jx:freezePanesFreezes rows and columns so headers stay visible while scrolling.Details →
jx:pageBreakInserts page breaks for print-ready reports. One section per page.Details →
jx:groupCreates collapsible outline groups for hierarchical reports.Details →
CommandWhat it doesPage
jx:protectProtects sheets from editing — lock formulas, structure, or specific cells.Details →

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.

Start with the most important command — the one you’ll use on every template:

jx:area →

Or jump straight to the loop command that does most of the heavy lifting:

jx:each →