Exporting data to Excel from Code

When using a Grid Table that is bound to an Entity Set, the Export button is not available.  To enable the export capabilities, the developer will need to create a custom Table Toolbar and button to allow the user to perform the export.

Exporting from a Custom Table Toolbar Button (CSV Format)


  1. Right click on the Grid Table control and add a Toolbar Container.
  2. Right click on the Toolbar Container and add a Toolbar.
  3. Right click on the Toolbar and add a Button.  (Configure the icon/text of the button as needed)
  4. Go into the Actions if Pressed property of the button to configure the action.
  5. Select Script for the Action and fabTableExportButtonPressed(evt) as the Parameter.

    You could also call a JavaScript function from here that contains the fabTableExportButtonPressed(evt) command.  Ensure that the function you create also takes in the (evt) parameter so that can be passed through correctly.



Exporting from other JavaScript Code (CSV Format)


  1. Add a JavaScript function into a Script node that contains the following command:

    fabExportTableData(tableName);

    Replace tableName with the ID of the table you would like to export data from.

  2. Add a button or some other way that the JavaScript function can be called.


3.3 Update

Starting on FAB 3.3 release, we now have the option to export Grid Table Data into XLSX format and with other exporting options like columnText and fullExport.

Exporting from a Custom Table Toolbar Button (XLSX Format)


  1. Right click on the Grid Table control and add a Toolbar Container.
  2. Right click on the Toolbar Container and add a Toolbar.
  3. Right click on the Toolbar and add a Button.  (Configure the icon/text of the button as needed)
  4. Go into the Actions if Pressed property of the button to configure the action.
  5. Select Script for the Action and fabGridTableExportButtonPressed(evt, columnText, fullExport) as the Parameter.

You could also call a JavaScript function from here that contains the fabGridTableExportButtonPressed(evt, columnText, fullExport) command.  Ensure that the function you create also takes in the (evt, columnText, fullExport) parameters so that can be passed through correctly.

Replace tableId with the ID of the table you would like to export data from.

Replace columnText with true for column names to display field description texts. Replace it with false if you want technical names to be displayed as column names.

Replace fullExport with true for full export on data. Replace it with false if you want to export filtered data, specifically the ones you see filtered and see on the current table display. 

Exporting from other JavaScript Code (XLSX Format)


  1. Add a JavaScript function into a Script node that contains the following command:

    fabExportGridTableData(tableId, columnText, fullExport);

    Replace tableId with the ID of the table you would like to export data from.

    Replace columnText with true for column names to display field description texts. Replace it with false if you want technical names to be displayed as column names.

    Replace fullExport with true for full export on data. Replace it with false if you want to export filtered data, specifically the ones you see filtered and see on the current table display. 

  2. Add a button or some other way that the JavaScript function can be called.


Full Export vs Filtered Export

Parameter fullExport gives us the option to export full or filtered data into excel file (XLSX format). Below is an example of how the data would look like with the two export options.


App Display


Full Export (fullExport = true)

It will export full data retrieved in the backend regardless of what was filtered in the frontend.


Filtered Export (fullExport = false)

It will export filtered data in the frontend.