
#Jxl api writableworkbook how to#
Import ĭef firstOrder = ( "Properties" ).getPropertyValue( "firstOrderProperty" )ĭef secondOrder = ( "Properties" ).getPropertyValue( "secondOrderProperty" )įile exlFile = new File("D:/target_file.xls") įinal WritableWorkbook writableWorkbook = Workbook.createWorkbook( exlFile ) įinal WritableSheet writableSheet = writableWorkbook.The below example program explains how to write / set data in spreadsheet without any formatting such as fonts etc. I don't know much about datasink but instead of the steps 4, 5 and 6 you can use a single groovy step: One final thing though, the excel file needs to be saved as xls (that is as an excel 2003 file). Label label2 = new Label( 1, requestCounter, documentNumber ) Label label = new Label( 0, requestCounter, customerPo ) WritableSheet writableSheet = writableWorkbook.getSheet(0) WritableWorkbook writableWorkbook = Workbook.createWorkbook(new File("D:\\test3.xls"), workbook) Workbook workbook = Workbook.getWorkbook(new File("D:\\test3.xls")) * Extract the customerPo and documentNumber from current requestĭef rawResponse = .ntentAsStringĭef customerPoStartIndex = rawResponse.indexOf("") + "".length()ĬustomerPo = rawResponse.substring( customerPoStartIndex, rawResponse.indexOf( "") + "".length()ĭocumentNumber = rawResponse.substring( documentNumberStartIndex, rawResponse.indexOf( "", documentNumberStartIndex ) ) and register the customerPo and documentNumber in an excel If a test step respects a certain naming then extract the response from it Loop through all the test steps in the current test case Get a list of all test steps in the current test caseĭef testSteps = () Define the customerPo and documentNumber variables Then in the groovy script I would filter for those requests, get all the required data and then finally write it to an existing excel: Note that all mine where named 'GetOrder_*' So the point of my solution is to name all your requests from where you want to extract the customerPo/documentNumber in a certain way.

#Jxl api writableworkbook code#
I only found a screenshot I took and the code (which was luckily saved in my clipboard manager). I also attached then the demo SoapUI project but I don't have it anymore. Hey, thought I answered to this on Friday evening but the answer was somehow lost. I need to write both the values one in A1 and another in A2.

It seems that it is writing the last data sink value. It gives me the response as another OrderNoĤ) Property Transfer :- I have created 2 properties for this First Order and Second Order and transfer it to the data sinkĤ) FisrtDataSink :- I am using the excel file and getting the FirstOrder response in the excel with the cell start at A1ĥ)SecondDataSink I am using the excel file and getting the FirstOrder response in the excel with the cell start at A2īut the thing it only prints second order response in A2 and A1 is blank. It gives me the response as OrderNoģ) Request2 : This is the request which has an another product item number and quantity as well as unique identifier. I get two responses and both should be written in the same excel file.ġ) DataSource - This is an unique identifier required in my request and I am using DataGenerator for it.Ģ) Request1 - This is the request which has an product item number and quantity as well as unique identifier.

I have scenario in which I need to write the response in the excel sheet.
