I was managed to write a script to do just that with the help of JExcel (unpack and place jxl.jar in soapui-installation-path/bin/ext) -- this assumes that your Soap request document contains everything except the Row elements:
import jxl.*;
def workbook = Workbook.getWorkbook(new File("C:\\Path\\To\\YourExcel.xls"))
def sheet = workbook.getSheet(0)
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "requestStep#Request" )
def rowsNode = holder.getDomNode("//Rows") // return a Rows Node
def updateRequestDoc = rowsNode.getOwnerDocument() // return a Document
// Clean up previous inserts
while (rowsNode.hasChildNodes()) {
rowsNode.removeChild(rowsNode.getFirstChild())
}
// Skip the header
for (int i = 1; i < sheet.getRows(); i++) {
Cell[] cells = sheet.getRow(i)
if (cells.length > 0) {
// Append Row node to the Rows Node
def rowElement = updateRequestDoc.createElement("Row")
rowsNode.appendChild(rowElement)
// Populate the Row node with all the "available" cells for that row (blank elements are skipped)
for (int j = 0; j < cells.length; j++) {
String cellContent = cells[j].getContents()
// Select the tag name based on the index in which it is parsed from the Excel document
if (!cellContent.isEmpty()) {
String tagName = null
switch(cells[j].getColumn()) {
case 0:
tagName = 'Col1'
break
case 1:
tagName = 'Col2'
break
case 2:
tagName = 'Col3'
break
default:
break
}
if (tagName != null && !tagName.isEmpty()) {
def currentElement = updateRequestDoc.createElementNS(tagName)
def currentTextElement = updateRequestDoc.createTextNode(cellContent)
currentElement.appendChild(currentTextElement)
// Get the last Row node and add the field element to it
def rowNode = rowsNode.getLastChild()
rowNode.appendChild(currentElement)
}
}
}
}
}
holder.updateProperty(true)
workbook.close()