---
title: EXCEL Generator
description: "Create Excel (XLSX) reports with data from Salesforce. Datadumps or complex groupings ... We got you covered. [https://www.youtube.com/watch?v=4_81hjmIzSI](https://www.youtube.com/watch?v=4_81hjmIzSI) Example: Above video explains same example. Let's say, you need to create an Excel report of Salesforce Opportunities. Follow below steps to…"
url: "https://pdfbutler.com/academy/pdf-butler-academy/pdf-butler-by-doc-config/excel-generator/"
updated: "2026-10-29"
category: PDF BUTLER BY DOC CONFIG
---

# EXCEL Generator

Create Excel (XLSX) reports with data from Salesforce. Datadumps or complex groupings ... We got you covered.

[https://www.youtube.com/watch?v=4_81hjmIzSI](https://www.youtube.com/watch?v=4_81hjmIzSI)

Example: Above video explains same example. Let's say, you need to create an Excel report of Salesforce Opportunities. Follow below steps to achieve this.

1. Create an Excel file with merge fields. [Here](https://pdfbutler.com/wp-content/uploads/2023/08/Sample-Document-with-merge-fields.xlsx) is the sample excel file you can download and make use of it.
    Few things that needs to be considered while creating excel file are
    - After adding merge fields, select the entire row of merge fields and give a name(Let's say "opportunity") in the Name box and press enter. Then save the excel file. As PDF Butler need to know which region in the excel should be repeated, this has to be done.
    ![PDF Butler Excel DocConfig - Excel Formatting 2](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-DocConfig-Excel-Formatting-2.png)
    - You can format the column data according to the data type of the merge field. Let's say, you have a Date column and wanted to format as short date in the final report. You can do this in excel file by selecting that Date merge field and choosing Short Date in the number format section.
    ![PDF Butler Excel DocConfig - Excel Formatting 1](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-DocConfig-Excel-Formatting-1.png)
2. Create SOQL Data Source to fetch opportunity records as below.
    ![Excel DocConfig - Opportunities Data Source](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-DocConfig-Opportunities-Data-Source.png)
3. Create Doc Config of Main Excel Document type as shown below.
    ![PDF Butler Excel DocConfig](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-DocConfig.png)
4. Open PDF Builder from the Doc Config and add the Data Source.
5. Upload the Sample excel file with merge fields in PDF Builder in Doc Config Documents sections.
6. Create Region Configtype for the repeating row(opportunity) which you have mentioned in the excel file.
7. Create Configtype for each merge field in the excel file as a child for Region configtype.
    ![PDF Butler Excel DocConfig-builder](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-DocConfig-builder.png)
8. Edit opportunity page to add the Excel DocConfig id.
    ![PDF Butler Excel DocConfig-opportunity page](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-DocConfig-opportunity-page.png)
9. Go to any opportunity and download the report. The report will fetch the opportunities from salesforce and displays all the information according to the format you have given in your doc config document excel file.
    ![Excel DocConfig - opp report](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-DocConfig-opp-report.png)

 

#### **Support Criteria Based on a Field in a Single Data Source (Excel Regions)**

 

You can now control the visibility of an **Excel Region** using **Criteria** based on a **field coming from a Single Data Source**.

With this capability, admins can dynamically show or hide Regions in Excel output files based on values coming from **a Single Data Source,**enabling more flexible document generation logic.

This enhancement is especially useful when a Region must appear only when a specific field in the Single Data Source contains a value, meets a condition, or is empty.

**When to Use This Feature**

Use Criteria with a **Single Data Source** when:

- Your Excel template contains a Region populated from a Single Data Source.
- You want to show/hide the entire Region depending on a field value.
- Your business logic requires conditional visibility without involving repeating rows or LIST data.

**Configuration Steps**

**1. Assign a Single Data Source to the Region**

In your **Excel ConfigType**, select your Region and assign a Single Data Source.

![](https://pdfbutler.com/wp-content/uploads/2023/08/1-1024x263.png)

**2. Open the Criteria Builder**

Inside the Region configuration:

1. Click **Add Condition** (or **Add Group**)
2. Select the **field** from the assigned Single Data Source
3. Define the criteria (Equals, Not Empty, Contains, etc.)

![](https://pdfbutler.com/wp-content/uploads/2023/08/2.png)

**3. Define Show/Hide Behavior**

A Region will:

- **Be shown** when the criteria evaluate to **true**
- **Be fully hidden** when the criteria evaluate to **false**

There is no partial rendering: the entire Region is removed from the final Excel document.

** Notes**

- Criteria for Single Data Sources work **exactly like criteria for LIST Data Sources**, but apply to a **single record only**.
- A Region with no criteria behaves normally (always visible).
- If criteria groups are used, they follow AND/OR logic as configured in the builder.

**⚠ Important Note About Data Placed in the Same Row as the Region**

If you add any static text, formulas, or other Excel content **in the same row where the Region is placed - but outside the Region boundaries, this content will also be hidden when the Region is hidden by criteria**.

Because the entire row is removed when a Region is not rendered, **any data on that row (even if not part of the Region)** will not appear in the generated Excel file.

**Recommendation:**
Place unrelated content **above or below** the Region's row(s) to ensure it always remains visible, regardless of criteria.

#### PERCENT field

Need to handle a Salesforce PERCENT field in Excel? Salesforce does not store Percent fields with decimals eg it will store 75% as 75. While Excel expects 0.75 to show 75% for a Percentage field. To achieve this, check the option **Check this box if the cell type in Excel is set to "Percentage"**for the percent configtypes in pdf builder.

Demo with Percent field: [https://www.youtube.com/watch?v=e3LtTojmRBA](https://www.youtube.com/watch?v=e3LtTojmRBA)

In the above example, probability is a percent field and you have to check the above option if you formatted the merge field as percent in the excel file as shown below.

![PDF Butler Excel DocConfig-percent type](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-DocConfig-percent-type.png)

#### Images

Repeat images for each region you replicate in the Excel. Perhaps you want to show a thumbnail of a product in a list.

Demo with Images: [https://www.youtube.com/watch?v=WEZ9v2tf-Ok](https://www.youtube.com/watch?v=WEZ9v2tf-Ok)

For more information on the PICTURE DataSource: [PICTURE DataSource - PDF Butler](https://pdfbutler.com/academy/pdf-butler-academy/pdf-butler-by-datasource/picture-datasource/)

Example: Above Demo explains same example. Let's say you want a report of opportunity products with image of each product in the row. You already understood how to create an excel file with merge fields in the beginning of this topic. Insert the picture placeholder in picture cell and add merge field to the picture placeholder. You can download the placeholder [here](https://pdfbutler.com/academy/pdf-butler-academy/pdf-butler-by-configtype/picture/).

![Excel DocConfig picture example](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-DocConfig-picture-example.png)

Follow below steps.

1. Create SOQL Data Sources to fetch the opportunity and opportunity products data. To fetch the product pictures, create picture list data source as a child for opportunity products Data Source as shown below.![PDF Butler Excel DocConfig-opp datasource](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-DocConfig-opp-datasource.png)![PDF Butler Excel DocConfig-opportunity products datasource](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-DocConfig-opportunity-products-datasource.png)![Excel DocConfig - picture list datasource](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-DocConfig-picture-list-datasource.png)
2. Create Excel type Doc Config and upload the sample document from [here](https://pdfbutler.com/wp-content/uploads/2023/08/Sample-Document-for-Image-Repeater.xlsx). Add created Data sources in Doc Config pdf builder.
    ![PDF Butler Excel DocConfig - PDF Builder](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-DocConfig-PDF-Builder.png)
3. Create Configtypes for each column in the excel file. Remember to Create Picture Configtype for picture column and map it to picture list data source as shown below.
    ![PDF Butler Excel DocConfig - Image Repeater configtypes](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-DocConfig-Image-Repeater-configtypes.png)
4. Edit opportunity page to add the Image Repeater Doc Config id. Go to any opportunity and download the report. The report will fetch the opportunity products with Images in each row.
    ![PDF Butler Excel DocConfig - Image Repeater report](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-DocConfig-Image-Repeater-report-e1745822914828.png)

#### Inline functions

Creating function in rows that are repeating by a REGION is possible by only using standard Excel functions. Use the Excel [INDIRECT](https://support.microsoft.com/en-us/office/indirect-function-474b3a3a-8a26-4f44-b491-92b6306fa261) function to dynamically identify the row.

Demo with Inline functions: [https://www.youtube.com/watch?v=0zpYt87bQ_Y](https://www.youtube.com/watch?v=0zpYt87bQ_Y)

Examples: Above Demo explains same examples. You can download the excel file to use it in the Doc Config [here](https://pdfbutler.com/wp-content/uploads/2023/08/Sample-Document-for-Inline-Functions.xlsx). Remember to add Regions for the repeating rows in your excel file as mentioned in the starting of this topic.
 As you have already learnt about how to generate excel report using PDF Butler in the starting of this topic, follow the same steps.

1. Above Doc Config Document needs Account data, all opportunities of the account and all opportunity products of each opportunity. Create Data Sources to get all these data.
2. Create a Doc Config of Main Excel Document type and upload the Doc Config Excel file. Add all the Data Sources.
    ![Excel Generator Inline Functions Example 1 DataSOurces](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-Generator-Inline-Functions-Example-1-DataSOurces.png)
3. Create correct Config type for each merge field in the Doc Config Excel file.![Excel Generator Inline Functions Example 1 Configtype1](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-Generator-Inline-Functions-Example-1-Configtype1.png)![Excel Generator Inline Functions Example 1 Configtype2](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-Generator-Inline-Functions-Example-1-Configtype2.png)![Excel Generator Inline Functions Example 1 Configtype3](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-Generator-Inline-Functions-Example-1-Configtype3.png)![Excel Generator Inline Functions Example 1 Configtype4](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-Generator-Inline-Functions-Example-1-Configtype4.png)![Excel Generator Inline Functions Example 1 pic1](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-Generator-Inline-Functions-Example-1-pic1.png)![Excel Generator Inline Functions Example 1 pic3](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-Generator-Inline-Functions-Example-1-pic3.png)

- Multiply the value in column "E" of the above Doc Config Excel file with a value in another sheet in the same excel file: **=INDIRECT("E" & ROW()) * 'Static Data'!B1**Open any Account record and add the Doc Config Id in PDF Butler convert component. Generate the excel report.
   ![Excel Generator Inline Functions Example 1 account record](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-Generator-Inline-Functions-Example-1-account-record.png)![Excel Generator Inline Functions Example 1 account export](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-Generator-Inline-Functions-Example-1-account-export.png)
- "IF" function to compare the value in column "F": **=IF(INDIRECT("F"&ROW())>1000;"YES"; "NO")**![Excel Generator Inline Functions Example 1 pic2](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-Generator-Inline-Functions-Example-1-pic2.png)

#### Summations/Averages/...

If you are repeating REGIONs, often you want a total of all values. You can just use the SUM function in Excel and specify a 1 cell region for the SUM. When generating, PDF Butler will automatically rewrite the region for the SUM.

In the example below, we want the SUM of all fixed costs when the are repeated. The [template](https://pdfbutler.com/wp-content/uploads/2023/08/Sample-Document-for-Inline-Functions.xlsx) will use cell "F8" for this example. So we create a region of this cell "F8:F8"

![](https://pdfbutler.com/wp-content/uploads/2023/08/Use-the-SUM-function-in-Excel-for-sum-of-repeating-rows-1024x248.png)

Demo with Inline functions: [https://www.youtube.com/watch?v=-3qu9SvMOBo](https://www.youtube.com/watch?v=-3qu9SvMOBo)

#### LINK ConfigType

Add links (URL) to your Excel. This can be used from a SINGLE or from a LIST DataSource.

Demo: [https://www.youtube.com/watch?v=GF9DtQH3p7Q](https://www.youtube.com/watch?v=GF9DtQH3p7Q)

In the same example given for Inline functions, you can add hyperlink field and try it out. Download the template [here](https://pdfbutler.com/wp-content/uploads/2023/08/Sample-Document-for-Inline-Functions.xlsx).

![Excel Generator Inline Functions link configtype](https://pdfbutler.com/wp-content/uploads/2023/08/Excel-Generator-Inline-Functions-link-configtype.png)

 

#### RICH_TEXT ConfigType

Excel support a downgraded version of Rich Text. So we cannot support all features but only what Excel allows. This can be used from a SINGLE or from a LIST DataSource.

#### Checkbox

You can add checkboxes to your excel and add logic to calculate checkbox value using 'Checkbox' Config type. Create an xlsx file as shown below and insert checkboxes with merge fields.

![](https://pdfbutler.com/wp-content/uploads/2023/08/Checkbox-in-Excel-pic9.png)![](https://pdfbutler.com/wp-content/uploads/2023/08/Checkbox-in-Excel-pic10.png)

**Example:**

Let's show below merge fields in Excel using Account Object. These are some of the examples that are explained in article. You can add any logic according to your requirements.

Acc: [[!AccountName!]] - Account Name to show in Excel
 Has notes? [[!HasNotes!]] - If Account has Note Records, then this checkbox will be set to true
 Has Website? [[!HasWebsite!]] - If Account has a website, then this checkbox will be set to true
 Is Burlington? [[!IsBurlington!]] - If Account Name Contains 'Burlington', then this checkbox will be set to true
 Name has A? [[!Name_A!]] - If Account starts with 'A', then this checkbox will be set to true

1. Go to Insert tab and Insert checkbox form control in to the cell and give some merge field name to it.
2. Create Doc Config of Type Main Excel Document.![Checkbox in Excel pic1](https://pdfbutler.com/wp-content/uploads/2023/08/Checkbox-in-Excel-pic1.png)
3. Create Data Sources as shown below.
    ![Checkbox in Excel pic2](https://pdfbutler.com/wp-content/uploads/2023/08/Checkbox-in-Excel-pic2.png) ![Checkbox in Excel pic3](https://pdfbutler.com/wp-content/uploads/2023/08/Checkbox-in-Excel-pic3.png)
4. Open PDF Butler configuration page and upload the xlsx template under Doconfig Documents. Create Config types as shown below![Checkbox in Excel pic4](https://pdfbutler.com/wp-content/uploads/2023/08/Checkbox-in-Excel-pic4.png) ![Checkbox in Excel pic5](https://pdfbutler.com/wp-content/uploads/2023/08/Checkbox-in-Excel-pic5.png) ![Checkbox in Excel pic6](https://pdfbutler.com/wp-content/uploads/2023/08/Checkbox-in-Excel-pic6.png) ![Checkbox in Excel pic7](https://pdfbutler.com/wp-content/uploads/2023/08/Checkbox-in-Excel-pic7.png) ![Checkbox in Excel pic8](https://pdfbutler.com/wp-content/uploads/2023/08/Checkbox-in-Excel-pic8.png)
5. Add Doc Config to the Account record and Generate excel.
    ![](https://pdfbutler.com/wp-content/uploads/2023/08/Checkbox-in-Excel-pic9.png)

##### Note

- You cannot use multiple merge fields in a single cell of your excel template. Only use one merge field per cell.
- PDF Butler provides an ability to generate your excel file as PDF. You can contact support team to enable this feature. Once license is enabled, below setting should be given in convert component to generate in PDF.
   ![PDF Butler Excel 1](https://pdfbutler.com/wp-content/uploads/2023/08/PDF-Butler-Excel-1.png)

#### **Replicating Excel Sheets Dynamically**

PDF Butler allows you to dynamically replicate Excel sheets based on records returned from a Data Source.

Steps to configure the excel template and Doc Config to replicate the Sheet: 

1. Configure the template:
    We need to replicate the sheet, so to do it we need to make the sheet dynamic. In order to do it as we cannot use squared brackets ([[ ]]) for the sheet, we will use {{ }}:
    ![](https://pdfbutler.com/wp-content/uploads/2023/08/Screenshot-2026-05-25-at-17.33.18-300x246.png)
2. Configure the Doc Config:
    Once you have uploaded the template and you have also added the data sources, we need to create the configtypes: - Create the Sheet ConfigType:
    ![](https://pdfbutler.com/wp-content/uploads/2023/08/Screenshot-2026-05-25-at-17.33.35-300x206.png)- Create a Single configtype inside the Sheet configtype. This will be the name for the sheets we are replicating. In my example I have selected the product Id from the data source, so we will be creating a sheet for each opportunity product related to the Opportunity and the name of the sheet will be the product Id. Be sure that the characters you have in the field you are using to name the sheet are permitted by excel. For example [], or : are not permitted:
    ![](https://pdfbutler.com/wp-content/uploads/2023/08/Screenshot-2026-05-25-at-17.33.57-300x224.png)
    - Then create the other single configtypes you need inside the excel file. In my example I am created
3. More single configtypes for the product name, quantity and price.
    ![](https://pdfbutler.com/wp-content/uploads/2023/08/Screenshot-2026-05-25-at-17.34.12-300x158.png)
4. Add the Doc Config to the PDF Butler lightning component and run it. The result will be as below:![](https://pdfbutler.com/wp-content/uploads/2023/08/Screenshot-2026-05-25-at-17.34.23-300x172.png)We will replicate the sheet for each opportunity product related to the opportunity. The name of the sheet will be the product Id and inside each sheet we will have the product name, quantity and price for each of the opportunity products related to the opportunity. 

#### **Column Remover**

The **Excel Column Remover** Config Type allows you to dynamically remove columns from generated Excel documents based on configured criteria. Please check this specific article to get more detals: [Click Here](https://pdfbutler.com/academy/pdf-butler-academy/pdf-butler-by-configtype/column-remover/)

 
