How to iterate throw Excel data in a groovy script?
I created a data source with Excel and want to use it in a groovy script. Using "Get Data" I can get individual properties but it appears to only pick out individual data properties from the last row. I would like to get the whole sheet as an object, either of rows and columns or a list of objects. How can this be best achieved?
If you are using data driven tests, it is possible to iterate the data source records without scripting. Please see the following documentation
Here another resource if you wanted only groovy way:
Thank you for the reply. I was aware of the data-driven concepts but they didn´t address the issue of me wanting to use the Excel Data within a groovy script. From your answer I guess the only way is to use a third party component like SoapUI. I will look into this.
Understanding that your goal here is to use the entire data set in a script. One approach I can think of would be to read in each row of data and perhaps pass this into an array. The syntax for referencing a row is as follows:
You can use a property/variable as the RowNumber to iterate through the data set.
Documentation for this is here if you want to get more details.