The following example shows you how to generate an XLSX workbook in memory. The getBytes method returns the complete file as a byte array, which is convenient in web applications where the workbook is sent to the client as a download and never stored on disk.
The save method also accepts any java.io.OutputStream, so the workbook can be written directly to a ByteArrayOutputStream, a response stream or any other destination.