This brief tutorial describes how to apply filter in Excel using Node.js. It has the details to set the development environment, a list of steps to be followed while writing the application, and a runnable sample code to filter Excel data using Node.js. An introduction will also be provided to work with the Excel filter like checking its existence, deleting a filter, and getting the data range of an existing filter.
Steps to Create Filter in Excel using Node.js
- Set the environment to use Aspose.Cells for Node.js via Java to set Excel filter
- Create a workbook and access the cells collection from a sheet
- Put sample data in the sheet
- Set the data range for the auto filter
- Add auto filter and refresh the sheet
- Save the workbook
These steps sum up the process of how to apply filter in Excel sheet using Node.js. Once the data is filled, the auto filter object is accessed from the selected sheet for setting the data range. An additional step is also demonstrated to set a filter by default and the refresh() method is called to set filtered data before saving the output Excel file.
Code to Add Filter in Excel using Node.js
This sample code demonstrates how to apply Excel filter using Node.js. The AutoFilter class has a variety of methods to work with for instance addDateFilter(), different variations of removeFilter(), addFillColorFilter, getRange(), addFontColorFilter(), and showAll() to list a few. You can also use the filterTop10() method to filter the top 10 entries in the list if required.
This article has taught us to apply filter in Excel using Node.js. If you want to create a chart in Excel, refer to the article on how to create chart in Excel using Nodejs.