cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO READ EXCEL FILE IN GROOVY

SOLVED
Occasional Contributor

HOW TO READ EXCEL FILE IN GROOVY

I am reading an excel file like below using poi3.6 jars

commons-collections4-4.1.jar
commons-collections4-4.1-javadoc.jar
commons-compress-1.18.jar
poi-3.16.jar
poi-examples-3.16.jar
poi-excelant-3.16.jar
poi-ooxml-3.16.jar
poi-ooxml-schemas-3.16.jar
poi-scratchpad-3.16.jar

 

FileInputStream file = new FileInputStream(new File('D:\\sample.xls'));
XSSFWorkbook workbook1 = new XSSFWorkbook(file)
XSSFSheet sheet1 = workbook1.getSheetAt(0)
Iterator ite = sheet1.rowIterator();

 

 

But always getting the error like 

 

  • Thu Jan 31 15:03:13 IST 2019:ERROR:An error occurred [org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList], see error log for details

 

Is there any other easy method of reading from an excel. Pplease help.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super Contributor

Re: HOW TO READ EXCEL FILE IN GROOVY

Please use ooxml-schemas-1.3.jar and try again.

Don't forget to accept as solution and give kudos.

View solution in original post

4 REPLIES 4
Highlighted
Super Contributor

Re: HOW TO READ EXCEL FILE IN GROOVY

Please use ooxml-schemas-1.3.jar and try again.

Don't forget to accept as solution and give kudos.

View solution in original post

Community Hero

Re: HOW TO READ EXCEL FILE IN GROOVY

Not sure if there is any specific requirement to use only excel for the data.
But, if you can use csv file (this can be read from excel as well), it is pretty easy to deal with it in SoapUI with help of small library
Download below files and copy under SOAPUI_HOME/bin/ext directory and restart.

http://central.maven.org/maven2/com/xlson/groovycsv/groovycsv/1.0/groovycsv-1.0.jar
http://central.maven.org/maven2/com/opencsv/opencsv/3.1/opencsv-3.1.jar

And find sample code below:
https://github.com/xlson/groovycsv


Regards,
Rao.
Occasional Contributor

Re: HOW TO READ EXCEL FILE IN GROOVY

Thank you it worked

Occasional Contributor

Re: HOW TO READ EXCEL FILE IN GROOVY

I will try this also