Create excel report from javascript which supports multiple sheets
A strigh forward way to create excel reports with multiple sheets in it.
- Clonse the repositiry
- change to the directory 'excelreportsgeneration'
- Load the 'index.html' file
- Click on 'Generate Report' button
I have used "js-xlsx" bower component as dev dependency here
Library support 1: js-xlsx
bower install js-xlsx
Ref URL : https://libraries.io/bower/js-xlsx
I used the js-xlsx version-0.10.7 here in example and added below library too,
Library support 1: js-xlsx-style
bower install js-xlsx-style
Ref URL : https://libraries.io/bower/js-xlsx-style
We can use only the min.js files alone also in our application.
<script lang="javascript" src="xlsx.full.min.js"></script>
and
<script lang="javascript" src="jszip.js"></script>
and Finally the fileSaver.js file for export functionality,
<script src="FileSaver.js"></script>
The file can be obtained from the code or from below github
Ref URL : https://github.com/eligrey/FileSaver.js/tree/master/src
Steps to remmeber:
- Specify the sheet structure
- Specify column structre & width properties
- Prepare data array
- Create column headers
- Iterate and insert data with relevant modifications as per requirement
- Export report using fileSaver functionalities
If you are using this project and happy with it or just want to encourage me to continue creating stuff, you can do it by just starring and sharing the project.
Any contributors who want to make this project better can make contributions, which will be greatly appreciated. To contribute, clone this repo locally and commit your code to a new branch. Feel free to create an issue or make a pull request.