Creating Excel Export Schema Templates in Docly

Exporting data to Excel (XLSX) files can prove to be a powerful tool for business, offering a familiar interface to analyze data and draw actionable insights. Let's delve into how to set up output templates in Docly schemas that produce Excel files as output.

How to Create Excel Files from Docly

Docly offers two distinct methods for creating XLSX files:

  • Creating Excel files from the integrated designer (HTML)
  • Creating Excel files with an XLSX as the template

Creating Excel Files from the Integrated Designer (HTML)

Creating a Single Sheet

To start, create a custom form in Docly. Once your form is set up, navigate to the templates tab and add a template, ensuring that the template ID ends with a .xlsx.

Here is a simple example template:

<table title="Sheet1">
    <thead>
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
            <th>Header 3</th>
        </tr>
    </thead>
    <tbody>
        <tr data-loop="Items">
            <td>#Field1#</td>
            <td>#Field2#</td>
            <td>#Field3#</td>
        </tr>
    </tbody>
</table>

Adding More Sheets

If you wish to add more sheets, just include additional table elements to the output, specifying each sheet's title in the "title" attribute. Here's an example:

<table title="Sheet2">
    <thead>
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
            <th>Header 3</th>
        </tr>
    </thead>
    <tbody>
        <tr data-loop="Items2">
            <td>#Field1#</td>
            <td>#Field2#</td>
            <td>#Field3#</td>
        </tr>
    </tbody>
</table>

Styles in Work Sheets

Docly supports the following styles in Excel:

  • background-color
  • color

You must place the styles within the style attribute, as shown:

<td style="background-color:#ff7722">#Field3#</td>

Creating Excel Files with an XLSX as the Template

Creating a Single Sheet

First, create a custom schema in Docly. Then, navigate to the templates tab, add a template, and upload your Excel file. Again, the template ID should end with a .xlsx.

Unlike the previous method, this approach allows you to use an existing XLSX file as a template, which can contain any objects and format you desire. Binding the values with the same HashJS syntax:

And there you have it! With these simple steps, you can quickly create schema templates for exporting data to Excel from Docly. Happy data crunching!

More details