Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Reading Excel (.xlsx) files

Avatar

Community Advisor

Hi,

I want to read the .xlsx files from dam. I am able to get the InputStream of this file from dam to pass it to Apache POI to read the data. However, in the run time, it is picking the below xml parser and throwing the error:

javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.EventFactory not found

I've tested this in stand alone Java application and its working fine without the above xmlparser. 

I also deployed this Apache POI as a OSGI bundle to make sure Felix has all the dependencies it needs.

Thanks.

3 Replies

Avatar

Level 3

Hi

It's hard for us to debug the issue.

However, I worked on something similar a while back and I have attached that piece of code. The code works on jxl api's.

Give it a look and verify if you can get it to work.

 

Regards

Varun mitra

Avatar

Community Advisor

varunmitra wrote...

Hi

It's hard for us to debug the issue.

However, I worked on something similar a while back and I have attached that piece of code. The code works on jxl api's.

Give it a look and verify if you can get it to work.

 

Regards

Varun mitra

 

 

Hi,

This only supports older formats (.xls). I know this API and it works well in AEM. But we want to use the latest Apache POI which supports all the versions of excel files.

Thanks.

Avatar

Community Advisor

Hello,

This issue should be fixed after installing service packs/CFP's on AEM 6.1/6.2 instances. Please update the POI dependencies as well.

<dependency>

  <groupId>org.apache.poi</groupId>

  <artifactId>poi-ooxml</artifactId>

  <version>4.0.0</version>

  </dependency>

  <dependency>

      <groupId>org.apache.commons</groupId>

      <artifactId>commons-compress</artifactId>

      <version>1.18</version>

  </dependency>

Most of the community articles or blog posts talks about reading data from .xls (older version) files. Apache POI reads/writes both older (.xls)/Newer(.xlsx) excel files within AEM.

Thanks.