Skip to content

Export to Excel Extension

OData provider provides support for Excel type response format in its Export to Excel Extension. From this service, an entity collection can be exported (downloaded) as an Excel file with file type '.xlsx'.

Export to Excel extension has been exposed as a REST API end point separating it from OData provider core.

Architecture

In order to generate the Excel output, a custom OOXML-Excel serializer pluggable, developed using Apache POI - Streaming XSSF (SXSSF) API is used in-place of Apache Olingo serializers (ODataXmlSerializer/ ODataJsonSerializer). Generated excel file will be invalidated in 5 minutes by default or the setting specified by -Dodp.extension.xlsx.cache.ttl.mins JVM Property

There are two ways in using this extension

Using only an HTTP GET request

Using HTTP POST + GET request combination

In this method, a GUID is generated as the Cache Id.

After HTTP POST request, the Excel File Download from Cache URL (which is used in following HTTP GET request) will expire if it is unused. Once HTTP GET request is performed, the parameters in the cache are removed. Therefore you can put only one HTTP GET request for a corresponding HTTP POST request.

Supported Types for Export

Export of following object types are supported.

  • Single Entity
  • Entity Collections
  • Exporting Structures (Complex Types)
  • List of Structures (Complex Collections)

The Export to Excel Extension Service of OData Provider facilitates operations such as renaming column names of Entities/Structures (complex types), ordering columns of Entities and string concatenation of Entity attributes.
For instance, you can concatenate two or more attributes/expanded attributes of string or integer datatype, to one single column using expressions.