Skip to content

jx:area

The jx:area command marks the rectangular region of your spreadsheet that XLFill will process. It’s the first command you’ll put on every template.

jx:area(lastCell="D10")

Place this in a cell comment on the top-left cell of your template region. The lastCell attribute is the bottom-right corner.

AttributeDescriptionRequired
lastCellBottom-right cell of the template areaYes

XLFill needs to know which part of your spreadsheet is the template and which part is static content. The jx:area command draws that boundary.

  • Everything inside the area is processed — expressions are evaluated, commands are executed
  • Everything outside the area is left untouched in the output

This means you can have headers, footers, or instructions outside the area that won’t be affected.

You almost always combine jx:area with another command in the same cell comment:

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

This says: “The template region is A1:D5. Within that region, loop over employees.”

  • Only one jx:area per template sheet
  • The area defines what gets processed, not what gets output — a jx:each inside may expand beyond the original area boundaries
  • If your template has a header row above the repeating row, include the header in the area so it appears in the output
  • No jx:area → nothing happens. Fill returns an error like “no jx:area commands found in template”. Every sheet you want processed needs one.
  • Putting it on the wrong cell. It must live in the comment of the top-left cell of the template region. Putting it in the middle works syntactically but the area starts where you put it, not where you intended.
  • Making lastCell too small. If your jx:each row sits below your lastCell, the engine ignores it. Stretch lastCell to the bottom-right of everything you want included.
  • Multiple areas on one sheet. You can have multiple jx:area commands on the same sheet (separate blocks). They’re processed independently — but don’t let them overlap.

Every example in the test suite uses jx:area. Browse all 19 runnable examples with input templates and filled outputs on the Examples page.

The command you’ll pair with jx:area on almost every template:

jx:each →