Read from excel file example

So I’ll take out pieces as this is more done in a test case then an keyword. You need at least these imports:

import com.kms.katalon.core.testdata.TestDataFactory
import com.kms.katalon.core.testdata.reader.ExcelFactory

set up your data:

nameForYourData = ExcelFactory.getExcelDataWithDefaultSheet('C:FILEPATHFOREXCELLFILE\\excelFileName.xlsx', 'SHEETNAMEHERE', true)

then pull your values into variables, many ways to get column or row such as variable you set in advance or randomly generate a number etc.

'-------------SHEET-VALUES---------------'
	String userName = nameForYourData .getValue(3, 1)
	String userPassword= nameForYourData .getValue(4, 1)
1 Like

Does this work for csv data?

I’m not sure, I’ve not tried that yet.