How to export data to excel sheet with colors and style in angular.
There are two most popular library for javascript to export data with excel sheet. 1) xlsx library 2) exceljs library If you would like to export simple data without changing its style then xlsx is perfact, but if you would like to change style before export then exceljs is perfect for JavaScript frameworks. Lets create an example with exceljs library to export data by changing style and colors for angular. Step 1: Install "exceljs" library npm install exceljs Step 2: Install "file-saver" library to save excel file. npm install file-saver Step 3: Import "exceljs" and "file-saver" library to your component. import * as ExcelJS from 'exceljs/dist/exceljs.min.js' ; import { saveAs } from 'file-saver' ; Step 4: Now create function in your component to export Data. exportExcel () { const workbook = new ExcelJS . Workbook (); const worksheet = workbook . addWorksheet ( 'My