How can I call data in multiple sheet from my excel file in one script
For example: my excel file has two sheets A and B, and I need to get data from them to put in my script. However, Katalon just loads data from one sheet at once ?
How can I call data in multiple sheet from my excel file in one script
For example: my excel file has two sheets A and B, and I need to get data from them to put in my script. However, Katalon just loads data from one sheet at once ?
Hi Nguyen,
Currently, a instance of TestData only loads one sheet that was specified in your Test Data.
To deal with your case, we can do this:
ExcelData myData = (ExcelData) ObjectRepository.findTestData(âyour_test_data_idâ)
def dataOfSheetA = myData .changeSheet(âsheet_Aâ).getAllData()
def dataOfSheetB = myData .changeSheet(âsheet_Bâ).getAllData()
To list all sheet names of a test data, please try:
myData.getSheetNames() (String)
Please remember that ExcelData is an implementation of TestData and only works for Excel file.
Hopefully, my sharing will help you.
DO we have any updates of have mutiple sheets ?
How can I call data which is in multiple sheets from my excel file(testData file) in one script??
ExcelData myData = (ExcelData) findTestData(âyour_test_data_idâ)
myData .changeSheet(âsheet_Bâ)
And now you can work with sheet_B but instead of using âfindTestData(âyour_test_data_idâ).â you will use âmyData.â.
If you want to go back to Sheet_A : myData .changeSheet(âsheet_Aâ)
In Katalon 5.7.0 version you can select, at the Data File (if Excel File), the sheet you want to use for the Data File. Unfortunatelly, we cannot select the desired specific sheet directly at the Variable Binding.
You just need to create multiple instances of same file in the âData Filesâ folder and keep every sheet as default for that instance. I am giving you example of 2 sheets I have, one sheet is ProducerPro and another is Contract.
Call them like this:
WebUI.setText(findTestObject(âPage_PM - Management/input_Agent Id_Producer_Producâ), findTestData(âData Files/DCMS_ProducerPro_Newâ).getValue(
âAgentIDâ, row))
WebUI.setText(findTestObject(âPage_PM - Management/input_Agent Id_Producer_Producâ), findTestData(âData Files/DCMS_Contract_Newâ).getValue(
âAgentIDâ, row))
Hi Nguyen,
You can refer to this link:
Hope that helps you. . .
Hi,
How I can read multiple sheets present in an excel in single test case and in single test suit.
So how I can achieve this in Katalon 7.3.0?