Take advantage of the full potential of Excel documents in FileMaker.
English version of the article by Nils Waldherr in German FileMaker Magazin, issue 2022-03 (PDF)
It has always been a basic requirement of a FileMaker solution to export data in Excel format – be it for distribution or for further processing. This function is supported since version 4, but the possibilities to alter the output document are limited – unless you use the MBS plug-in together with the LibXL extension. Then there are practically no more limits – and now with FX Reports there is even to need for the sometimes tedious programming of the scripts.
The procedure is very simple: You search for the records you want to export, sort them if necessary and select "Export records ..." from the main menu. A few clicks later you have the desired file on your desktop. It is even faster if you automate the export via script.
If the document is intended for distribution to third parties, it is not uncommon for additional steps to be taken manually, such as adjusting column titles and widths, adding a summary field, and so on.
Just to automate the adjustment of column titles, almost every developer has sacrificed valuable lifetime – countless workarounds testify to this: special export tables, virtual tables, temporary data sets, VBA scripts, to name just a few.
tl;dr: Excel exports from FileMaker are simple, but limited. If you use the MBS plug-in with LibXL, almost all Excel features are supported, but the programming is demanding. In addition, output formats are usually hardcoded in scripts. FX Reports dynamizes the output via templates, which the users can edit themselves in the best case.
If you want to use the full potential of Excel documents, you can't get around the MBS plug-in. Since version 2.9 (October 2012) you can create and edit full-fledged Excel documents with the help of the LibXL library. Almost everything that can be done with Excel can be scripted in FileMaker with the help of the plug-in, such as the use of multiple worksheets, formatting with fonts, colors and frames, graphics and logos, functions, filters and numerous options for display and printing. The plug-in currently provides 320 functions for this purpose (Excel functions of the MBS plug-in).

However, you should not be afraid to use a plug-in: Anyone who has already created an export with MBS and LibXL knows the individual programming effort required. The writing of the Excel file is done cell by cell. In addition, an output format created in this way is always part of the programming, i.e. it is practically hard-coded and every change requires the necessary knowledge and rights to the database file.
A customer from the social sector works with numerous exports, both in the daily workflow and in the form of reports that are sent automatically to the respective authorities. Including variants, there are almost one hundred different formats that have to be maintained constantly due to changing regulations. In the future, the customer would like to be able to make these adjustments himself. In addition, all changes should be available at several server locations.
Instead of having to modify the respective script for each change and then transfer these changes to all other instances of the application, a dynamic, data-driven solution is required.
FX Reports was developed for this purpose, a meta-format based on JSON for describing Excel documents – a so-called JSON schema (Understanding JSON Schema).
Based on this schema (Schema definition of FX Reports), templates can now be created that completely describe the desired Excel document in terms of form and content. The other part of FX Reports, the application component, processes these templates and generates a corresponding output file using the MBS plug-in and LibXL in the background.
The advantages are obvious: no programming knowledge or experience with the MBS plug-in is required to create and customize export formats, and delivering new formats is a breeze.
After downloading the project from GitHub, copy the MBS plug-in suitable for your platform and the LibXL file into the FileMaker Extensions folder – if not already present. Restart FileMaker if necessary and open the FX_Reports.fmp12 file.

Enter two curly brackets "{}" in the text field and press "Generate xlsx". There should now be a file on the desktop in a new folder named "fx_reports" with the current timestamp as its name, which will be opened automatically with Excel (or a compatible spreadsheet application). The empty JSON object "{}" represents the Excel document to be created, using default values for options that are not set. The file name can be set with "filename", for example:
xxxxxxxxxx{ "filename": "Test.xlsx" }Next up, we add a data row with two cells to the template. Do not forget to close the document in Excel, otherwise your file cannot be overwritten.
xxxxxxxxxx{ "filename": "Test.xlsx", "rows": [ {"values": ["Hello", "World" ]} ]}
An integration of FX Reports into your own application is very simple: The file FX_ReportsExample.fmp12 shows the implementation into a common starter solution. Two custom functions for error handling, a script and a table representation are needed. If you want, you can use the provided add-on to import everything into your own solution. FX Reports then works hidden in the background.
In the downloaded project directory there is an examples folder, which contains some practical example templates. Copy or move this folder to the desktop to make the paths in the examples work. To try out a template, open the respective JSON file in a text editor, copy the content and paste it into FX Reports.
In this simple example, the values of the individual output rows are written directly into the cells. The "columnWidth" property is used to specify that the column width should be adjusted to its content.
The output lines from the contacts.xlsx file are processed and only new column titles are added. In "simple-header-extra" the columns are filtered with "fields" and the column headers are set to bold. In addition, the column width is automatically adjusted. The "fields" property also offers the possibility to change the order of the columns if necessary. With this filter function you can easily define individual variants with an extensive standard export or offer a GUI for the selection of the columns to be output.
This template creates four worksheets, the first of which uses Excel's "freeze window" function with the worksheet property "display.freeze" and the second of which hides the so-called grid lines. In the third worksheet the zoom level for the display is set and in the last one options for the print output are defined.
A template is first of all a JSON document with a defined structure, the so-called schema. Templates can be created and edited with practically any text editor. Visual Studio Code (or VS Code for short), which even works in the browser, is particularly recommended – and also free of charge (VSCode homepage).
The schema is used internally to validate a template, but can also support the input during manual creation.

Even easier – and without any JSON knowledge – you can do this online with the template editor: The current schema is already stored and the desired template can be put together simply by selecting the available elements.
The "Update Form" button can also be used to load an existing template for editing. The examples provided offer a good introduction to this.

For the basic structure and options of a template, please refer to the documentation on GitHub , which is constantly updated.
True to the motto "simple things should be simple, complex things should be possible" (Alan Kay), with a little practice even complex exports can be realised with FX Reports. Since no knowledge of FileMaker is required, adjustments can be made directly by the user. Another advantage is that output formats in the form of templates can be maintained and delivered as data and thus independently of the program code.
In GUI mode, all functions can be used without restriction. The implementation in your own solution requires a valid licence. This is available in the FileMaker Magazine shop (9) for both the FileMaker client and the server, for example, if exports are to be created by schedule. For a trial license you can contact FMGARAGE. Also follow FMGARAGE on Twitter and GitHub or like and subscribe to the project repo.
Nils Waldherr has been professionally involved with FileMaker since version 2 (1992). His Berlin-based company FMGARAGE works for customers of all sizes and develops components for developers and users of enterprise solutions.