Hi,
I want to download an Excel file in my OutSystems app using JavaScript. The Excel should be filled with data from the database (like Name, Address, and Phone for each employee).
I'm using O11, and I already added an Excel template in Resources. I’m using the ExcelJS library in JavaScript.
But I’m not sure how to pass the data from an aggregate or local list to JavaScript and use it to fill the Excel file.
I'm not using any Forge components. Thanks in advance!
Hi @Juvairiya,
Pls take a look at this component below.
exceljs-o11 or go through this link: Github ExcelJs
If you want to download the database data as an Excel file, we have a Record List to Excel node in OutSystems (note that it operates on the server-side).
Hi @Juvairiya Jabbar ,
There's no need to overcomplicate things with an external JS library just for a simple Excel export.
OutSystems already provides built-in widgets for this.
You can create a server action and use the RecordListToExcel logic inside the flow. Just pass in your data as a list of the needed type, and return the result as a Binary Data output.
Then, in the UI, call this action, pass the aggregate list, and use a Download node to trigger the file download.
Please check the attached OML.
Hi Mihai Melencu
Thanks for the suggestion!
But in my case, I want to use a pre-designed Excel template that already has my styles, fonts, and formatting. The RecordListToExcel widget creates a new file from scratch, so it won’t keep my custom styles.
That’s why I’m using JavaScript and ExcelJS — I added the template to Resources and just want to fill the data into specific cells , but keep the formatting.
If there's a way to do this while keeping the original Excel styles, please let me know.
You can use the Advanced Excel component for this. In the documentation section you have couple of sample guides for certain use cases.
Documentation: Advanced Excel | Documentation .