...
I suggest we use the package ExcelJS (https://github.com/exceljs/exceljs) to generate our xlxs document. It is a popular packages with close to 1 million weekly downloads (npm), has a readable API and the generated spreadsheet is fully styleable
The most popular alternative, SheetJS, has recently moved off of GitHub, has security vulnerabilities, and requires a pro account to style. We had actually previously imported SheetJS into our codebase, but it was not used and removed this year in a package cleanup PR
It is a large package, 1.1MB minified and 259.1kB minified and gzipped according to Bundlephobia
As a point of comparison, a single sheet xlsx file as we generate in certification export is 8-9kB. This suggests we should be creating the xlsx file on the server and sending via API to the frontend. However there are some other considerations we can keep in mind.
We don’t yet know the specifications of the file we will be generating (e.g. I believe they will be more highly styled than the certification documents) and they may end up larger
The client can cache the library code, making the difference in data sent to the client less noticeable as more documents are exported
This might be worth testing on different devices in terms of responsiveness
Folder structure: I suggest generating the Excel document in a function in
packages/api/util
that can be used by the controller or, if we decide to restructure, the frontendWe don’t yet have the exact specification for this document (data content or visuals), but we can set up the framework (saga → controller → document generation → download) now with some data available on the current finance homepage
There is a mockup of the filtering page (the page that selects which data will be exported) which I would like to get confirmed before we start work on it
...