cancel
Showing results for 
Search instead for 
Did you mean: 

SoapUI free version: error message when reading excel files with groovy code

Occasional Contributor

SoapUI free version: error message when reading excel files with groovy code

I get error message when reading excel file

There is on one column in this file

the code is as the following:

import org.apache.poi.xssf.usermodel.*

def fs = new FileInputStream("C:\my file location\SoapUI_DataA.xlsx")

def wb = new XSSFWorkbook(fs)

def ws = wb.getSheet("Sheet1")

def r = ws.getPhysicalNumberOfRows()

for ( def i=0 ; i<r; i++) {

def row = ws.getRow(i)

log.infor cell.getStringCellValue()

 

I have parameter c_name (Country Name) and I would like to user excel file as input for this parameter

All files are in here:

 

https://drive.google.com/drive/folders/0B80gqU807MGTblc4WXNaNmY0ZVE?usp=sharing

 

Thank you for your help

8 REPLIES 8
Community Hero

Re: SoapUI free version: error message when reading excel files with groovy code

If I were you, I would use .csv instead of .xls file. And use below library which **bleep** simple, find example in below thread:
https://github.com/xlson/groovycsv


Regards,
Rao.
Super Contributor

Re: SoapUI free version: error message when reading excel files with groovy code

Replace backslash with double backslash

def fs = new FileInputStream("C:\\my file location\\SoapUI_DataA.xlsx")

 

or you can use this answer

http://stackoverflow.com/questions/1701839/string-replaceall-single-backslashes-with-double-backslas...

 

then } is missing at the end of last line.

Occasional Contributor

Re: SoapUI free version: error message when reading excel files with groovy code

Hi Rao,

 

How to use (How to import it to Soapui open source 5.3)?


@nmrao wrote:
If I were you, I would use .csv instead of .xls file. And use below library which **bleep** simple, find example in below thread:
https://github.com/xlson/groovycsv

Thanks

Occasional Contributor

Re: SoapUI free version: error message when reading excel files with groovy code

 

 

I get an error message to read csv file

 

Soapui_CSV.png

Community Hero

Re: SoapUI free version: error message when reading excel files with groovy code

What libraries have been copied under SOAPUI_HOME/bin/ext directory?


Regards,
Rao.
Occasional Contributor

Re: SoapUI free version: error message when reading excel files with groovy code

Hi Rao,

 

I copy groovycsv-1.1.jar to  SOAPUI_HOME/bin/ext directory2017-04-21 09_41_28-SoapUI 5.3.0.png


@nmrao wrote:
What libraries have been copied under SOAPUI_HOME/bin/ext directory?

 

Community Hero

Re: SoapUI free version: error message when reading excel files with groovy code

If you notice, the above mentioned link specified the dependencies as well. So please download and add them too.


Regards,
Rao.

Re: SoapUI free version: error message when reading excel files with groovy code

Hi , I have add all the jar file related to it still i am getting the same error message. 2019-02-21_1952.png

New Here?
Join us and watch the welcome video:
Top Kudoed Authors