Skip to content

This guide is for builders who want people to download records as a formatted document — a purchase order as a PDF, a contract in Word, a monthly list in Excel. By the end you will be able to write a template file, add it to an entity, make it available in a view or an automation, limit it to the right records, and keep large Excel exports fast.

An export template is a document you prepare in advance — a Word file, an HTML page or an Excel sheet — with placeholders where record values go. You upload it to an entity. When someone exports with it, OSOS fills the placeholders with the record’s values and hands them the finished file.

Take a Purchase Request entity. A Purchase Order template in Word holds the company letterhead, a table of items and a signature block. A buyer opens an approved request, selects Purchase Order, and downloads a PDF with the request’s supplier, items and total filled in.

Each template has a Level:

  • Single Entry — one document for one record (the purchase order).
  • Multiple Entries — one document for several records at once (a monthly list of all requests).

Templates are used in three places:

  • In a view — people export from the records list or from a record’s details. See Make the template available.
  • In an automation — the Generate File action of a reaction produces the file automatically, for example to attach it to an email.
  • Template exports produce Word, PDF or Excel files only. For a quick CSV or Excel dump of a list, use the view’s quick export instead (see Data Views).
TypeYou uploadPeople receive
WordA Word file (.docx)A Word document
PdfA Word file (.docx) or an HTML file (.html)A PDF
ExcelAn Excel file (.xlsx)An Excel workbook

Prepare the entity first: the fields your template uses must exist, and the names in the template must match the fields’ identifiers exactly (for example title).

In every template, entries is the list of records being exported and entry.value.<field> is one field of one record. A Single Entry export still passes a list — with one record in it.

Use {{% … %}} for logic, such as a loop, and {{%= … %}} to print a value:

<!DOCTYPE html>
<html>
<head>
<title>Requests</title>
</head>
<body lang="en-US" dir="ltr">
{{% for(entry of entries){ %}}
<h1>Title</h1>
<p>{{%=entry.value.title %}}</p>
{{% }; %}}
</body>
</html>

HTML is the only type that can export records containing decorated (formatted) fields.

Define a short alias for a field, then print it inside a loop:

<{{ALIAS title INS $entry.value.title}}>
<{{FOR entry in entries}}
{{* title}}
{{END-FOR entry}}>
  • ALIAS title INS $entry.value.title names the value title for use in the loop.
  • {{FOR entry in entries}} … {{END-FOR entry}} repeats its content once per record.

Put a placeholder in a cell; the column is filled with that field from every record, one row per record:

<${table:entries.value.title}>

A value that starts with = is written as text, not as a formula. To write a real formula, build it with formula() (see the functions below).

These functions are available in every template. All of them except the last two rows (getImage, getImageSrc and mdToHtml, which belong to one document format) also work in variables:

FunctionGives you
today()Today’s date in your timezone; pass an amount to shift it.
date(value, format)A date formatted the way you want, for example date(entry.value.needed_by, 'dd/MM/yyyy').
loc(value)The text of a two-language value in the reader’s language.
mdToText(value)Formatted (markdown) text as plain text.
formula(text)An Excel formula cell (Excel templates).
fetchEntry(ref), fetchEntriesById(entity, ids), fetchEntries(entity, filter)Related records, to print their values.
getStepName(entry, stepId), getCurrentStepOwner(entry), getStepOwner(entry, stepId), getStepReceivedAt(entry, stepId)Workflow information: a step’s name, who owns the current step, who owned a step, when a step was reached.
getStepActions(entry, stepId), getStepActionName(entry, stepId, actionId), getStepHistory(entry, stepId), getStepLastHistory(entry, stepId)The actions and the history of a workflow step.
getEntryComments(entry), getEntryEmails(entry)The record’s comments and emails — Single Entry templates only.
getImage(…) (Word), getImageSrc(…) (HTML)An image field, embedded in the document.
mdToHtml(value) (Word and HTML)Formatted (markdown) text as formatted document text.
  1. Open the entity: Administration › Applications › Data Entities, then select the entity.
  2. Select the Templates tab, then New Template (or Add Template if the entity has none yet).
  3. Fill in the form:
    • Name — also the default name of the downloaded file. It must be unique among this entity’s templates.
    • Level — Single Entry or Multiple Entries.
    • Type — Excel, Pdf or Word.
    • Sensitive Data Access Policy — shown only if the entity has sensitive fields; see Sensitive fields in exports.
    • File — select Choose file and upload the template you prepared.
    • Export Type — UI Export builds the file straight away and downloads it; Background Export builds it in the background and tells the person when it is ready. Choose Background Export for large exports.
  4. Optionally, for a Single Entry template, set a condition.
  5. Optionally, open Advanced Options to add variables.
  6. Select Save.

A template on the entity is not yet offered to anyone. To let people export with it from a view:

  1. Open the entity’s Views tab and open the view.
  2. Under Templates (in the entries-list settings for Multiple Entries templates, and in the entry-details settings for Single Entry templates), tick the templates people may use in this view.
  3. In the view’s Buttons section, the templates appear alongside the other buttons — drag them to set their order.
  4. Save the view.

To produce the file automatically instead, add a Generate File action to a reaction and pick the template. To email it as well, follow Generate a PDF from a record and email it.

A Single Entry template can carry a condition, so that only records that meet it can be exported with it — for example, a Purchase Order only for approved requests.

  1. In the template form, under Filter, choose a saved query, write conditions, or both.
  2. In For other entries, choose what people see on a record that does not meet the condition:
    • Disable export option (the default) — the template is listed but greyed out, with “This entry doesn’t meet the conditions to export using this template” on hover.
    • Hide export option — the template is not listed for that record.
  3. Save.

Multiple Entries templates cannot have a condition. A conditioned template can only be used on records people have selected, not on a whole list. The Generate File reaction action does not check template conditions.

Variables let you calculate a value once and use it in the template like a field. Open Advanced Options and write them in Variables as a list of names and expressions:

{
"full_name": "entry.value.first_name + ' ' + entry.value.last_name",
"due": "date(entry.value.needed_by, 'dd/MM/yyyy')"
}

Each expression is worked out for every record, and the result is available as entry.value.full_name, entry.value.due and so on. Expressions can use the functions above, except getImage, getImageSrc and mdToHtml. You can also wrap an expression in {{%= … %}}; the wrapper is ignored.

Technical details

The name extended is reserved. Setting "extended": "true" switches the template to an extended export that also receives the entity’s own design — its module, reactions, notifications, workflows, lists, queries, views and relations — for producing documentation of an entity’s configuration. An extended export always covers the whole source and always runs immediately.

Large Excel exports: keep the sheet simple Since 1.4

Section titled “Large Excel exports: keep the sheet simple Since 1.4”

A large Excel export is much faster — and the file much smaller — when the template is simple enough to be written a page of records at a time. Your template qualifies when all of these hold:

  • It has exactly one sheet.
  • Every placeholder fills a whole cell, is a plain ${table:entries.…} placeholder, and all of them sit on the same row, with nothing else on that row.
  • Nothing below that row has a value, and no merged cells reach that row or below.
  • The sheet has no formulas, images, Excel tables, conditional formatting, data validation, filters or named ranges.

A template that does not qualify still works; it is just slower on very large exports. If an export of many thousands of records is slow, simplify the sheet (move headings and totals above the table row) or ask your operator which rule the template breaks.

The Templates tab is also available on virtual entities, such as Groups, when the entity may be edited. A template export over a virtual entity includes the rows the person selected.

If the entity has sensitive fields, choose a Sensitive Data Access Policy for the template:

PolicySensitive values in the document
PrivilegedAlways shown. This is what a template without a policy does.
ProhibitedNever shown — replaced by ****.
User-BasedShown only if the person exporting may see them.
AutoShown when an automation generates the file; decided by the person’s own access when a person exports.

The template’s own policy applies even when a reaction generates the file. Fields set to Encrypt are never shown in a document, whatever the policy. See Sensitive-data access policy.

  • Exporting from a view uses the view’s columns. A template field that the view does not display can come out blank. Add every field the template uses to the view (you can hide columns people do not need on the list face), or export from a view that shows them.
  • The downloaded file is named after the template unless the export gives it another name.
  • Comments and emails can be printed only in Single Entry templates.
ProblemWhat to check
A value is blank in the documentThe field identifier in the template must match the entity exactly. If you exported from a view, the view must display that field.
The template is not offered in a viewTick it under the view’s Templates, and check its Level: Single Entry templates appear on a record, Multiple Entries templates on the list.
The template is greyed out on a recordThe record does not meet the template’s condition.
“The template name is unique on the entity level”Another template on this entity already uses that name.
Sensitive values show ****The template’s Sensitive Data Access Policy masks them, or the field is Encrypted.
A PDF template produces no fileA PDF template must be uploaded as .docx or .html.

Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27