Create Filter in Excel using Java

<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.xls.free</artifactId>
<version>3.9.1</version>
</dependency>
</dependencies>
import com.spire.xls.ExcelVersion;
import com.spire.xls.Workbook;
import com.spire.xls.Worksheet;

public class CreateFilter {
public static void main(String[] args){
//Load an Excel file
Workbook workbook = new Workbook();
workbook.loadFromFile("sample3.xlsx");

//Get the first worksheet
Worksheet sheet = workbook.getWorksheets().get(0);

//Create filter
sheet.getAutoFilters().setRange(sheet.getCellRange("A1:F1"));

//Save the result file
workbook.saveToFile("CreateFilter.xlsx", ExcelVersion.Version2010);
}
}

--

--

--

Sharing Java Code

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to make multiples folder Python by remansunuwarofficial

How to Let the World See Your Sweet, Sweet Ruby on Rails JSON API Using Ubuntu 14.06 and Nginx

Getting Started with Expressions in After Effects

Why Should You Choose MERN Stack Development for Your Web Application?

Comparison Between 3rd & 2nd Ranked Framework: Flutter Vs Angular

Set up SSL Certificates with WebFaction Quick and Easy

Creating a build pipeline in jenkins installed in a containcer with dockerfile

How much does mobile app development cost?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrew Wilson

Andrew Wilson

Sharing Java Code

More from Medium

Java Basics

Java Basic 101

Time importance in java

Open-source SPL that can execute SQL without RDB