Forum Discussion

dief123's avatar
dief123
Occasional Contributor
6 years ago

Data driven- can i feed multiple columns of the spreadsheet into a single field in service call?

I have an excel spreadsheet data driven loop in my testcase.  I want to setup multiple columns in the spreadsheet with different data, but I want to be able to loop thru each cell on each row and feed the test that way.  So I want to process Row 1 and put column A into a variable in the service call and have it execute, then loop thru and continue on Row 1, but feed Column B into the variable.  Then, I want it to move to Row 2, and loop thru each cell?

 

Is this possible and if so, how do i set it up?

  • Nastya_Khovrina's avatar
    Nastya_Khovrina
    SmartBear Alumni (Retired)

    Hi dief123,

     

    The Excel data source obtains data from the Microsoft Excel file. It assigns data from the columns to the properties in the order they are listed in the editor. That is, the value of the first column will be assigned to the first property, the second column - to the second property, and so on. It works with one row per iteration. So, it there are several columns, you cannot go through cells one by one in order to assign the cell value to one property.

     

    But, you should be able to achieve your task using a groovy script. Here is the article to start:

    Example of using third-party Java libraries in Groovy script: reading from Excel file using Apache POI