Is there a way to export to excel using an API.
I want to use a cron job that exports and Emails reports.
Also, Is there a way to export the reports with colors and formats?
Dotan
Hello, Dotan,
Thank you for writing to us.
Yes, there is a way to export reports to Excel for scheduled emails:
The general idea lies in using the headless browser technique to generate a page with Flexmonster in the browser, not displayed in the interface.
This way, you will have access to Flexmonster on the backend, and you will be able to use the API calls to generate the report (export it, for example, to Excel using the exportTo() API call) to attach it to the scheduled email. Flexmonster is a client-side application that runs in the browser, which is the reason to use the browser on the server-side.
There are several headless browser tools that can be used for this, for example, Puppeteer.
Please, check a sample GitHub project with Flexmonster and Puppeteer: https://github.com/flexmonster/pivot-puppeteer. It demonstrates how to export the report using server-side capabilities. More detailed steps are provided in our documentation: https://www.flexmonster.com/doc/export-report/#export-without-browser.
As for exporting with colors and formats:
Due to some limitations, Flexmonster exports not all colors and fonts to Excel. Kindly note that if you used customizeCell, it wouldn't be visible in the export. Since every cell's style can be unique when using customizeCell - such a function would take a lot of time. Therefore, an export report with customized cells is impractical because it would last much longer.
Still, colors that are applied through conditional formatting and certain theme-related colors will be exported by default. You are welcome to check out how export works on our interactive demo.
Please let us know if this helps.
Kind regards,
Vera