# Excel (XLSX)

Use this page when you want to design a workbook in Microsoft Excel and generate a true `.xlsx` file from Salesforce data.

An XLSX template is built in Excel, then uploaded to S-Docs for generation.

Use it when spreadsheet structure matters more than HTML layout, Word editing, or slide design.

{% hint style="info" %}
Pick **XLSX** when you need spreadsheet-first output, Excel design tools, and bracket-based S-Docs syntax.
{% endhint %}

### When XLSX is the right fit

Use XLSX templates when you need:

* Microsoft Excel workbook design tools
* a generated `.xlsx` file
* merge fields inside a workbook
* conditional sections in worksheet content
* named queries in Microsoft template syntax
* generation through **S-Docs LWCs** or the **SDK** with the newer upload flow

XLSX is a strong fit for data exports, pricing workbooks, operational reports, and spreadsheet-first deliverables.

### How XLSX templates work

The workbook design lives in Excel.

The dynamic data comes from S-Docs syntax placed inside the `.xlsx` file.

XLSX templates use bracketed Microsoft template syntax around S-Docs blocks and merge fields.

{% code title="xlsx-basic-syntax.txt" %}

```plaintext
[{{!Account.Name}}]

[<!--RENDER='{{!Opportunity.StageName}}' == 'Closed Won' -->]
  Closed-won summary
[<!--ENDRENDER-->]
```

{% endcode %}

### Conditional logic

Use conditional logic when worksheet content should appear only for certain records.

XLSX conditional logic uses the same `RENDER` model as other Microsoft templates.

Wrap both the opening and closing tags in square brackets.

{% code title="xlsx-render-block.txt" %}

```plaintext
[<!--RENDER='{{!Contact.Phone}}' != 'NULL' -->]
  Phone: [{{!Contact.Phone}}]
[<!--ENDRENDER-->]
```

{% endcode %}

Keep merge fields inside rendered content in square brackets too.

Use the same operators you use in standard S-Docs conditional logic.

{% code title="xlsx-render-operators.txt" %}

```plaintext
[<!--RENDER=( ('{{!Account.BillingState}}' == 'CA' || '{{!Account.BillingState}}' == 'NV')
             && '{{!Account.Active_Contract__c}}' == 'True' ) -->]
  Regional account with active contract
[<!--ENDRENDER-->]
```

{% endcode %}

Nested render blocks work too.

{% code title="xlsx-render-nested.txt" %}

```plaintext
[<!--RENDER='{{!Opportunity.StageName}}' == 'Closed Won' -->]
  Congratulations on your purchase.
  [<!--RENDER1='{{!Opportunity.Install_Date__c}}' != 'NULL' -->]
    Installation is scheduled for [{{!Opportunity.Install_Date__c}}].
  [<!--ENDRENDER1-->]
[<!--ENDRENDER-->]
```

{% endcode %}

Common fixes:

* If the block prints as text, add square brackets around both `RENDER` tags.
* If a field inside the block stays blank, wrap that merge field in square brackets too.
* If the condition never matches, verify the field path and comparison value.

{% hint style="info" %}
Starting with S-Docs Summer '25 (`v10.0`), XLSX generation uses the newer Microsoft template upload flow when enabled.

That improves consistency, file handling, and performance for supported generation paths.
{% endhint %}

### Supported features

XLSX templates support these common S-Docs capabilities:

* merge fields
* conditional logic
* named queries
* Excel-native formatting and formulas

### Important constraints

Keep these XLSX rules in mind:

* Live Edit is not supported.
* Template headers and footers are not supported.
* Component templates are not supported.
* S-Sign is not supported.
* Related lists are not supported.
* Leading zeros and strict number formats may need explicit Excel formatting.

### Next reads by goal

* Need the build steps? Read [Build and Upload an XLSX Template](/sdocs/template-architecture/document-formats/xlsx-format/build-and-upload-an-xlsx-template.md).
* Need setup details? Read [XLSX Rendering Considerations](/sdocs/template-architecture/document-formats/xlsx-format/xlsx-rendering-considerations.md).
* Need merge field syntax? Read [Merge Fields With Microsoft Templates (DOCX, PPTX, XLSX)](/sdocs/template-architecture/inserting-merge-fields/merge-fields-with-microsoft-templates-docx-pptx-xlsx.md).
* Need conditional syntax? Read [Quick Setup: Conditional Logic With Microsoft Templates (DOCX, PPTX, XLSX)](/sdocs/advanced-template-logic/conditional-logic/quick-setup-conditional-logic-with-microsoft-templates-docx-pptx-xlsx.md).
* Need named query patterns? Read [How To: Advanced Data Retrieval with Named Queries](/sdocs/advanced-template-logic/named-query/how-to-advanced-data-retrieval-with-named-queries.md).
* Need formatting help for leading zeros? Read [Preserve leading zeros in Excel output](/sdocs/template-architecture/document-formats/other-formats/leading-zeroes-for-xls-templates.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.sdocs.com/sdocs/template-architecture/document-formats/xlsx-format.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
