cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: uploading data through excel 2010 Version

vijay_kumar49
Active Contributor
0 Kudos

Hello,

We are uploading the data through excel 2007 version, Now my client wants ask to upload the data in either of the version(2007   to   2010) of excel.


Could you  plz share any sample example to upload the data in excel 2010.


Do we get any errors if we convert 2007 to 2010  version  if so,? how to solve it


Which jar files will  support to 2010  and below versions?


Please do needful help.


Thanks in advance

Vijay

Accepted Solutions (0)

Answers (1)

Answers (1)

Sharathmg
Active Contributor
0 Kudos

Try to use the apache POI jar file. It should support the latest versions of excel.

Regards,

Sharath

vijay_kumar49
Active Contributor
0 Kudos

Thanks for replying, as of now i am using "poi-3.7-20101029.jar" file for uploading excel-2007 version.

Client will upload either excel-2007 or excel-2010 version.(means both versions suitable for uploading excel) So, Which Apache POI is suitable for both versions.

Working with .xlsx files

The classes we used in above code snippet, HSSFWorkbook and HSSFSheet works for .xls format. In order to work with newer xls format viz .xlsx, you need to see newer POI classes like:

import org.apache.poi.hssf.usermodel.HSSFSheet; // for Excel 2007

import org.apache.poi.xssf.usermodel.XSSFSheet; // for Excel 2010

//..

FileInputStream file = new FileInputStream(new File("C:\\test.xlsx"));

Use XSSFWorkbook and XSSFSheet class in all of the below examples in order to make them work with .xlsx files.

So, for uploading both versions of excels which Apache POI Version is suitable for both versions of excel(2007,2010)?

Is it possible for uploading both version of excel(2007 or 2010) by Apache POI?

Thank you,

Regards

Vijay

Sharathmg
Active Contributor
0 Kudos

Hello Vijay,

I am not exactly sure if one method / interface can handle both versions.

As a workaround, you can have two apis and separate methods for each version of excel.

Based on the uploaded type, you can make use of the relevant interface.

Regards,

Sharath