Updated: March 19, 2021

Export to Spreadsheet

sap.ui.export.Spreadsheet

Intro

“Export to Spreadsheet” is a utility for exporting data from an app to a spreadsheet, enabling users to work with the data in common spreadsheet applications. Typical use cases are to mix the data with other sources, perform complex calculations, or change the layout of the data (for example, to present the content differently).

Usage

Use “Export to Spreadsheet” if:

  • Users need to work with the data in common spreadsheet applications.
  • Exported data should be the same as displayed (for example, taking visible columns, column order, filter, and sort settings into account).
  • The amount of data to be exported is limited.

Do not use “Export to Spreadsheet” if:

  • You want to export a complete database table. Use custom-built exporters instead.
  • You need to export large tables. Use custom-built exporters instead.

Behavior and Interaction

“Export to Spreadsheet” can be used in all cases where the exported data can be represented in a tabular format. The export is independent of the control used to display the data in the app. It can be used not only for tables, but also for all other controls that work internally with tabular or hierarchical data, such as charts.

The exported file contains only simple read-only text content. Basic data type information can be configured per column, such as text, integer number, floating point number, date, and so on. Since spreadsheet applications provide their own formatting for cell content,  SAPUI5 formatters (for example, for dates, times, and numbers) are not taken into account.

You can combine several data points and display them in one cell, or spread them over several cells.

In the spreadsheet files, tree structures are displayed using the grouping functionality (first seven levels) and double indentation (all levels).

During the export, a modal progress dialog is displayed. The user can cancel the export at any time.

As soon as the spreadsheet file has been created, it is offered for download automatically.

Warning
The file size of the exported file is limited by the available browser memory. Exporting large tables can therefore lead to memory overflows and browser crashes.

The recommended maximum table size is 1 million table cells for desktop browsers or 100,000 table cells on tablets and phones.

For larger tables, consider using custom-built, specialized export solutions instead.

Exporting to a spreadsheet
Exporting to a spreadsheet

Guidelines

Provide a button for triggering the export, for example, on the toolbar of the corresponding control.

'Export to Spreadsheet' button
'Export to Spreadsheet' button

When you configure the exporter, ensure that your data is converted to a tabular representation. For example, when exporting a list item, configure the exporter to display each data point in a separate column.

Only combine data points in the exported file if this makes sense for your use case. Nicely formatted cells with combined data points are fine for presentations. However, for complex calculations or mass editing in spreadsheet applications, they can be rather cumbersome.

Example:
The first column in an application shows a text and the corresponding ID, for instance Astro Laptop 1516 (HT-1251). In the export file, you can either put the entire text into one cell, or configure the export to display the data in two different columns. The second solution allows users to sort and filter by both data points individually in spreadsheet applications.

For tables, export the data as it is displayed on the screen:

  • Export all visible columns in the same order as they are displayed on the screen.
  • Take the view settings (sort, group, filter, …) into account.
  • Use the same column header texts.

When exporting, convert non-text elements to a text-only representation. Non-text elements include icons, images, micro charts, or controls like checkboxes and buttons. Converting them to text ensures that the data is not lost in the exported spreadsheet file.

Resources

Want to dive deeper? Follow the links below to find out more about related controls, the SAPUI5 implementation, and the visual design.

Elements and Controls

Implementation