Reputation: 33625
I want to use Apache POI library to parse excel files (old versions and newer versions of excel). So I was wondering what jars do i need to include from the Apache POI because in following link:
http://mvnrepository.com/artifact/org.apache.poi
I found lots of jars to be included, do I need to include them all?
If so, what is the latest stable version to be included, and does it work with Microsoft's Office 2010?
Upvotes: 37
Views: 206892
Reputation: 161
Since POI 5.0.0, some housekeeping has been done:
According to the official FAQ:
poi-ooxml-full
was previously known as ooxml-schemas
poi-ooxml-lite
was previously known as poi-ooxml-schemas
According to the official components list:
poi-ooxml
now transparently requires poi-ooxml-lite
As @mustafa918 noticed, you should refer to https://poi.apache.org/components/index.html#components to find out which dependency you need. To work with XLS, poi
will be enough; for XLSX you will need to add poi-ooxml
Upvotes: 0
Reputation: 626
Apache POI has mainly two libraries,
You can add anyone depend on your need. Difference can be found here.
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.2</version>
</dependency>
Upvotes: 2
Reputation: 11
<?xml version="1.0" encoding="UTF-8"?>
4.0.0 org.springframework.boot spring-boot-starter-parent 2.5.5 com.dolphin excel 0.0.1-SNAPSHOT excel Excel Sheet Import Into Databse Using SpringBoot And Apache Worbook <java.version>1.8</java.version> org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-web
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10-FINAL</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
The Main Code For Apache POI Then Update Update Maven Project
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10-FINAL</version>
</dependency>
This Will Work
Upvotes: 0
Reputation: 2001
To read an Excel file with Apache POI 5.0.0 like this:
Workbook wb = WorkbookFactory.create(myFile);
... the following libraries are required (latest versions as I'm typing this):
If myFile
is a ".xls" file, one more library has to be added:
Upvotes: 0
Reputation: 64
Add these dependencies to your maven pom.xml . It will take care of all of the imports including OPCpackage
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
Upvotes: -2
Reputation: 8320
No, you don't have to include all of POI's dependencies. Maven's transitive dependency mechanism will take care of that. As noted you just have to express a dependency on the appropriate POI artifact. For example:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.8-beta4</version>
</dependency>
Edit(UPDATE): I don't know about previous versions but to resolve imports to XSSFWorkbook and other classes in org.apache.poi package you need to add dependency for poi-ooxml too. The dependencies will be:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
Upvotes: 66
Reputation: 19
There are multiple jars which are required for your APACHE POI to work with your application.
List of JAR file:-
Upvotes: 1
Reputation: 37816
The following works for me:
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.16</version>
</dependency>
Upvotes: 3
Reputation: 518
this is the list of maven artifact id for all poi component. in this link http://poi.apache.org/overview.html#components
Upvotes: 3
Reputation: 63
Add this dependency to work with Apache POI
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.16-beta1</version>
</dependency>
Upvotes: 0
Reputation: 3422
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10-FINAL</version>
</dependency>
Upvotes: 2
Reputation: 21
I used the below dependency. If you are using Selenium then it's good to use all of them as below. Else you will see some errors and then do the reserch and add some more dependencies.
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>openxml4j</artifactId>
<version>1.0-beta</version>
</dependency>
Upvotes: 2
Reputation: 21
If you are not using maven, then you will need **
Upvotes: 0
Reputation: 43
ooxml for dealing the .xlsx files and the ooxml refers to the xml, hence we will be needed to refer the below three dependedncies in the pom.xml for the
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>
Upvotes: -2
Reputation: 2907
For an excel writer you might need the following:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10-FINAL</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${apache.poi.version}</version>
</dependency>
Upvotes: 9