Questions tagged [apache-poi]

Apache POI is a Java library for reading and writing various Microsoft file formats, especially Office related ones. It supports OLE2 and OOXML based formats, such as XLS, XLSX, DOC, DOCX, PPT and PPTX as well as a few others.

The mission statement of the Apache POI project is

... to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft's OLE 2 Compound Document format (OLE2). This includes Excel formats (.xls and .xlsx), Word (.doc and .docx), PowerPoint (.ppt and .pptx), as well as others to a lesser extent like Visio, Outlook and Publisher.

This tag should be used for questions around using and extending Apache POI. Questions on the .Net port should use the tag instead.

More information on Apache POI, the bug tracker and download links are available from https://poi.apache.org/

If you are starting with Apache POI, you may find the Busy Developer's link very useful : https://poi.apache.org/spreadsheet/quick-guide.html

Apache POI releases are available under the Apache License, Version 2.0.

9727 questions
10
votes
6 answers

Apache-POI: Unable to write to an existing workbook

I'm working on a project which needs to read an Excel Workbook, calls the necessary Web Services, and then takes the response from the webservices and enters that information in to the same Excel Workbook that was read. Here is the error I'm…
Matthew Lancaster
  • 521
  • 3
  • 12
  • 22
10
votes
4 answers

Error While Reading Large Excel Files (xlsx) Via Apache POI

I am trying to read large excel files xlsx via Apache POI, say 40-50 MB. I am getting out of memory exception. The current heap memory is 3GB. I can read smaller excel files without any issues. I need a way to read large excel files and then them…
jamesT
  • 329
  • 2
  • 4
  • 18
10
votes
1 answer

Reading data from xlsx with Apache POI's SXSSFSheet

I want to read data ( cell values ) from a certain xlsx file using apachi poi. The code below creates the SXSSFWorkBook instance successfully and assigns db.xlsx ( my dummy xlsx). I have tried changing sheet numbers and double checking it with the…
Ozan
  • 206
  • 1
  • 4
  • 13
10
votes
5 answers

How to add new sheets to existing excel workbook using apache POI?

I am trying to write List data into multiple excel sheet in one work book. like for first list, the code will create new workbook and create new sheet for list[1], for second list it will create new sheet in existing workbook and so on. so i wrote…
Priyank Shah
  • 609
  • 3
  • 9
  • 25
10
votes
3 answers

Reading date value from excel cell as a String

I am using apache poi library to read excel file. I am stuck while reading password cell. If user gives date as a password in password cell i.e. 16/05/2012. I am reading this value as "41045" while value should be "16/05/2012". This is my code :…
Nandkumar Tekale
  • 16,024
  • 8
  • 58
  • 85
10
votes
5 answers

apache POI exception in reading xlsx files

I'm using apache POI for reading xlsx files by adding below dependencies org.apache.poi poi-ooxml 3.8
pavan
  • 3,225
  • 3
  • 25
  • 29
9
votes
4 answers

How to parse UTF-8 characters in Excel files using POI

I have been using POI to parse XLS and XLSX files successfully. However, I am unable to correctly extract special characters, such as UTF-8 encoded characters like Chinese or Japanese, from an Excel spreadsheet. I have figured out how to extract…
user1198370
  • 91
  • 1
  • 1
  • 2
9
votes
2 answers

Creating excel sheet from template in Java, new versions of Excel

I found the following code to create a excel sheet from an existing template with formats and add data to it and save it to a new file POIFSFileSystem fs = new POIFSFileSystem( new FileInputStream("template.xls")); HSSFWorkbook wb = new …
cma3982
  • 91
  • 1
  • 1
  • 3
9
votes
5 answers

Exception in thread "main" java.lang.NoSuchFieldError: Factory

Recently upgraded POI jar version from 3.17 to 5.1 and below code which was working in 3.x is now broken, ( jdk 1.8 ) Below are the set of Jar used below is my stub: import java.io.File; import java.io.FileInputStream; import…
Warrior
  • 3,184
  • 12
  • 44
  • 53
9
votes
4 answers

How to call a Macro from Apache POI library in Java?

I have : Macro named "process" that does all the processing work for my worksheets. I want my Java code that uses Apache POI, to call this macro so that it can process the sheets for me. How can I call a Macro in Apache POI in Java ? :: Note…
Yugal Jindle
  • 44,057
  • 43
  • 129
  • 197
9
votes
2 answers

XSSF POI is cell date

Is there a way to determine if cell is a date? I know about style.getDataFormatString() but that doesn't help me, because I can't determine if is formating is for date or not.
Zemzela
  • 3,060
  • 6
  • 23
  • 32
9
votes
1 answer

What is the difference between poi and poi-ooxml

I'm learning about data driven testing using Selenium and Excel. I'm taking an online course that has asked used to add the Apache poi and poi-ooxml dependencies in Maven. I'm struggling to understand what the differences between the two are. Are…
user983988
9
votes
2 answers

Found interface org.apache.poi.util.POILogger, but class was expected error

public String readExcel(String columnname,String UserType) { try { FileInputStream file = new FileInputStream(path); @SuppressWarnings("resource") XSSFWorkbook wr = new XSSFWorkbook(file); …
Ravi
  • 107
  • 1
  • 1
  • 4
9
votes
1 answer

How to make solid color for databar in apache.poi

I'm trying to create a sheet with progress bar which will represent some progress. I'm using these libraries: org.apache.poi:poi:4.1.0 org.apache.poi:poi-ooxml:4.1.0 org.apache.poi:poi-ooxml-schemas:4.1.0 All I get is a progress bar with gradient,…
9
votes
2 answers

Apache POI set selected cell after xls document opens

We have next situation: our system has data export in xls format, this is huge file with many rows and columns. And after user download and open document he see document scrolled to last column and last Spreadsheet tab. This is very annoying, better…
Andriy Kopachevskyy
  • 7,276
  • 10
  • 47
  • 56